public void Start() { AppServer = new MyServer(); var port = PortHelper.GetFirstAvailablePort(); if (!AppServer.Setup(port)) { throw new Exception("Failed to setup!"); } if (!AppServer.Start()) { throw new Exception("Failed to start!"); } Console.WriteLine($"start at port:{port}"); AppServer.NewRequestReceived += StringRequesthandler; AppServer.NewSessionConnected += NewConnectionCome; }
public static ICommunicator Build() { return(new HttpCommunicator(PortHelper.GetFirstAvailablePort())); }