Пример #1
0
        public void Start()
        {
            foreach (KeyValuePair <short, IJHSInterface> that in m_MessageHandlersDict)
            {
                JHSNetworkServer.RegisterHandler(that.Key, OnNetworkReceive);
            }

            JHSNetworkServer.Start();
        }
Пример #2
0
    public void Connect()
    {
        JHSNetworkServer.RegisterHandler(InternalMessages.DISCONNECT, OnDisconnect);
        //    JHSNetworkServer.RegisterHandler(InternalMessages.RECIEVE, OnNetworkReceive);
        RegisterHandeler(NetworkConstants.LOGIN, new LoginHandler());
        RegisterHandeler(NetworkConstants.REGISTER, new RegisterHandler());
        RegisterHandeler(NetworkConstants.UPDATE_SITE_DATA, new UpdateSiteDataHandler());
        RegisterHandeler(NetworkConstants.GET_NEW_URL, new Ask4NewUrlHandler());
        RegisterHandeler(NetworkConstants.CHAT, new ChatHandler());
        RegisterHandeler(NetworkConstants.OPEN_CHAT, new ChatOpenHandler());
        string ListenIP   = Program.configs.GetValue <string>("HOST");
        int    ListenPort = Program.configs.GetValue <int>("PORT");
        int    password   = Program.configs.GetValue <int>("ServerPassword");
        int    Version    = Program.configs.GetValue <int>("Version");

        JHSNetworkServer.Start(ListenIP, ListenPort);
        LOG.Error("No error, server started!");
    }