static void BombServer(string service, IPAddress ip, int port, string certPath, string certPass) { //Load the certificate to use X509Certificate2 serverCertificate = new X509Certificate2(certPath, certPass); //Set up a TCPListener TcpListener listener = new TcpListener(ip, port); listener.Start(); Console.WriteLine("Bomb {0} server listening on {1}:{2}", service, ip, port); while (true) { try { //Get TCPClient and pass to a new thread TcpClient client = listener.AcceptTcpClient(); new Thread(() => Processors.DirectoryServerProcessor(service, client, serverCertificate)).Start(); } catch { } } }
static void MainServer(string domain) { //Initialize a HTTPListener (Requires admin) HttpListener listener = new HttpListener(); listener.Prefixes.Add(domain); Console.WriteLine("Server URL: {0}", domain); listener.Start(); Console.WriteLine("Listening..."); while (true) { try { //Get listener context and pass to a new thread HttpListenerContext context = listener.GetContext(); Console.WriteLine("New request!"); new Thread(() => Processors.MainServerProcessor(context)).Start(); } catch { } } }