/// <summary> /// Runs the TCP server mode /// </summary> public void Run() { TcpEchoServer echoServer = new TcpEchoServer(serverPort); echoServer.ConnectionTimeout = connTimeout; echoServer.OnConnect += new TcpEchoServer.OnConnectDelegate(echoServer_OnConnect); echoServer.OnDisconnect += new TcpEchoServer.OnDisconnectDelegate(echoServer_OnDisconnect); echoServer.OnDataReceived += new TcpEchoServer.DataReceivedDelegate(echoServer_OnDataReceived); echoServer.OnSocketException += new TcpEchoServer.SocketExceptionDelegate(echoServer_OnSocketException); Console.WriteLine(string.Format(Messages.TCPServerCaption, serverPort)); echoServer.Start(); Console.ReadKey(true); echoServer.Stop(); }
/// <summary> /// Runs the TCP server mode /// </summary> public void Run() { var echoServer = new TcpEchoServer(_serverPort) { ConnectionTimeout = _connTimeout }; echoServer.OnConnect += echoServer_OnConnect; echoServer.OnDisconnect += echoServer_OnDisconnect; echoServer.OnDataReceived += echoServer_OnDataReceived; echoServer.OnSocketException += echoServer_OnSocketException; Console.WriteLine(Messages.TCPServerCaption, _serverPort); echoServer.Start(); Console.ReadKey(true); echoServer.Stop(); }