Пример #1
0
        private void ListenClient(object obj)
        {
            TcpClientListener listener = null;

            while (true)
            {
                try
                {
                    var tcpClient = _tcpListener.AcceptTcpClient();
                    listener = new TcpClientListener(tcpClient, ClientDisconnected);
                    _tcpClientListeners.Add(listener);
                    listener.ClientDataReceived += _dataReceivedhandler;
                    listener.StartSocketListener();

                    OnClientConnected(tcpClient.Client.RemoteEndPoint as IPEndPoint);
                }
                catch (SocketException ex)
                {
                    EventLog.WriteEntry("Application", ex.Message);
                    break;
                }
            }
        }
Пример #2
0
 public void SendMessage(byte[] bytes, TcpClientListener clientListener)
 {
     clientListener.SendMessage(bytes);
 }