예제 #1
0
        public bool Start(ushort port)
        {
            bool ret = false;

            if (m_net_socket != null)
            {
                ret = m_net_socket.Listen(port, OnAcceptConnect, OnMessageReveived, OnConnectClose);
            }
            if (ret)
            {
                Log.Info("服务器已经启动 port:" + port);
            }
            else
            {
                Log.Error("服务器开启失败 port:" + port);
            }
            return(ret);
        }
        public bool Start(string ip, ushort port)
        {
            bool   ret  = false;
            string host = "ws://" + ip + ":" + port;

            if (m_net_socket != null)
            {
                ret = m_net_socket.Listen(port, OnConnectOpen, OnMessageReveived, OnConnectClose);
            }
            if (ret)
            {
                Log.Info("for client服务器已经启动 host:" + host);
            }
            else
            {
                Log.Error("for client服务器开启失败 host:" + host);
            }
            return(ret);
        }