示例#1
0
        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;
        }
示例#2
0
 public static ICommunicator Build()
 {
     return(new HttpCommunicator(PortHelper.GetFirstAvailablePort()));
 }