Exemplo n.º 1
0
        private void AcceptCallback(IAsyncResult ar)
        {
            Socket socket = ConnectionSocket.EndAccept(ar);

            _clientSockets.Add(socket);

            Console.CursorTop += 1;
            Console.CursorLeft = 0;
            Console.WriteLine("Client Connected: " + socket.RemoteEndPoint);

            socket.BeginReceive(_buffer, 0, _buffer.Length, SocketFlags.None, new AsyncCallback(ReceiveCallback), socket);
            ConnectionSocket.BeginAccept(new AsyncCallback(AcceptCallback), null);
        }