示例#1
0
        void ReadComplete(IAsyncResult iar)
        {
            SocketError error;
            int         length = client.EndReceive(iar, out error);

            if (error == SocketError.ConnectionReset)
            {
                return;
            }
            reader.Add(buffer, length, HandleMessage);
            client.BeginReceive(buffer, 0, 4096, SocketFlags.None, ReadComplete, null);
        }