static void Main() { _configuration = ReadConfiguration(); string host = _configuration["tcp:host"]; int port = int.Parse(_configuration["tcp:port"]); using (var tcpServer = new TcpServer(host, port)) { tcpServer.Start(); tcpServer.ClientConnected += Listen; Console.WriteLine("Press enter to exit"); Console.ReadKey(); } }
public void Start() { tcpServer = new TcpServer(IPAddress.Any, Port); tcpServer.Start(); tcpServer.BeginAcceptTcpClient(new System.AsyncCallback(OnAccept), tcpServer); }