static void Test5() { var svr = new HttpReverseProxy(); svr.RemoteServer.Host = "www.cnblogs.com"; svr.Port = 888; svr.Start(); while (true) { Console.Title = "在线 {0:n0} {1}".F(svr.SessionCount, svr.StatSession); Thread.Sleep(500); } }
public Task StartAsync(CancellationToken cancellationToken) { var set = Setting.Current; var server = new HttpReverseProxy { Port = 8080, RemoteServer = "http://star.newlifex.com", Tracer = DefaultTracer.Instance, Log = XTrace.Log, }; if (set.Debug) { server.SessionLog = XTrace.Log; } #if DEBUG server.SocketLog = XTrace.Log; server.LogSend = true; server.LogReceive = true; #endif server.Start(); _proxy = server; // var server2 = new HttpReverseProxy // { // Port = 80, // RemoteServer = "http://star.newlifex.com", // Tracer = DefaultTracer.Instance, // Log = XTrace.Log, // }; // if (set.Debug) server2.SessionLog = XTrace.Log; //#if DEBUG // server2.SocketLog = XTrace.Log; // server2.LogSend = true; // server2.LogReceive = true; //#endif // server2.Start(); // _proxy2 = server2; return(Task.CompletedTask); }