Exemplo n.º 1
0
        private void ListenForClients()
        {
            bListenForClients = true;

            while (bListenForClients)
            {
                Client acceptClient = new Client();
                try
                {
                    acceptClient.Socket = listener.AcceptTcpClient();

                    listenForMessageDelegate
                        = new ListenForMessageDelegate(ListenForMessages);

                    listenForMessageDelegate.BeginInvoke
                        (acceptClient, new AsyncCallback(ListenForMessagesCallback), "Выполнено!");
                }
                catch (Exception)
                {
                    bListenForClients = false;
                }
            }
        }