/// <summary> /// Stops the server. /// </summary> internal static void Stop() { lock(_syncRoot) { DisposableBase.DisposeOf(_server); _server = null; } }
private void Start() { Debug.Assert(_server == null); _server = new TcpServer( endpoint: ServiceConfiguration.Server.Endpoint, handler: new ProxySessionManager(CreateReader()), backlog: ServiceConfiguration.Server.ConnectionBacklog); _server.Start(); }
private void RunCore(IMessageReader reader, IPEndPoint endpoint, int connectionBacklog) { using(var server = new TcpServer( endpoint: endpoint ?? new IPEndPoint(IPAddress.Any, ProxyMessageReader.DefaultPort), handler: new ProxySessionManager(reader), backlog: connectionBacklog)) { server.Start(); CmdLineCancelKey.WaitFor().Dispose(); } }