private void InitServer() { if (server != null) { server.Dispose(); } server = webServerGenerator.GenerateInstance(); server.StartWebServer(ipFinderResult.MyIP, Constants.CommunicationPort); }
private List <KeyValuePair <string, IWebServer> > StartListeners(List <string> IPs, string communicationKey) { var servers = new List <KeyValuePair <string, IWebServer> >(); foreach (var item in IPs) { IWebServer ws = webServerGenerator.GenerateInstance(); ws.StartWebServer(item, Constants.IPFinderCommunicationPort); ws.AddResponseUrl("/" + communicationKey + "/", (Func <IWebServer, RequestDetails, string>)WebServerFetched); System.Diagnostics.Debug.WriteLine($"Started listener at {item}:{Constants.IPFinderCommunicationPort}. url is /{communicationKey}/"); servers.Add(new KeyValuePair <string, IWebServer>(item, ws)); } return(servers); }