public void StartAll() { Console.WriteLine("Starting servers!"); foreach (ServerManager server in Config.Servers) { Thread serverThread = new Thread(async() => { await server.StartAsync(Config.Path); }); serverThread.Start(); ServerThreads.Add(server.Name, serverThread); } OnServersStarted(new EventArgs()); }
private void StartServer() { _listener = new TcpListener(IPAddress.Any, Config.LocalListenPort); _listener.Start(); //spawn appropriate number of server threads for (int i = 0; i < Config.ServerThreadPoolCount; i++) { Server server = new Server(Config, _listener, _logger); ServerThreads.Add(server); //We listen to server events so that received file changes will not trigger //a send event from the Client server.ReceiveBegin += ServerReceiveStart; server.ReceiveEnd += ServerReceiveComplete; server.Start(); } }