Beispiel #1
0
        private void OnReceiveCallback(IAsyncResult ar)
        {
            try
            {
                int    length = _stream.EndRead(ar);
                byte[] data   = new byte[length];
                Buffer.BlockCopy(_buffer, 0, data, 0, length);

                if (data.Length >= 2)
                {
                    handlePacket(data);
                }

                new Thread(new ThreadStart(BeginRead)).Start();
            }
            catch
            {
                GameServerManager.GetInstance().RemoveClient(this);
                Log.Error("Lost connection from gameserver");
            }
        }
Beispiel #2
0
 private void Accept(TcpClient tcpClient)
 {
     GameServerManager.GetInstance().AddClient(tcpClient);
 }
Beispiel #3
0
 private void close()
 {
     GameServerManager.GetInstance().RemoveClient(this);
     this._stream.Dispose();
 }