Beispiel #1
0
 public void StartRecive()
 {
     while (true)
     {
         int size = gameSocket.Receive(buffers);
         LogTool.GetInstance().Log("接收服务器的消息{0}", Encoding.UTF8.GetString(buffers, 0, size));
     }
 }
Beispiel #2
0
        public override void Initialize()
        {
            gameSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            gameSocket.Connect(new IPEndPoint(IPAddress.Parse(IP), port));
            LogTool.GetInstance().Log("连接成功,发送消息");
            SendReq("First Msg from Client");
            Thread t = new Thread(StartRecive);

            t.Start();
        }