/// <summary> /// 关闭套接字 /// </summary> /// <param name="socket">套接字</param> private static void dispose(TmphClient socket) { socket.Socket.shutdown(); }
/// <summary> /// 获取HTTP转发代理服务客户端 /// </summary> /// <returns>HTTP转发代理服务客户端,失败返回null</returns> internal virtual TmphClient GetForwardClient() { var host = forwardHost; if (host != null) { var TmphClient = new TmphClient(host, true); if (TmphClient.IsStart) return TmphClient; TmphClient.Dispose(); } return null; }
/// <summary> /// HTTP转发代理 /// </summary> /// <param name="socket">HTTP套接字</param> /// <param name="TmphClient">HTTP代理服务客户端</param> public TmphForwardProxy(TmphSocket socket, TmphClient TmphClient) { this.socket = socket; this.TmphClient = TmphClient; requestSocket = socket.Socket; proxySocket = TmphClient.NetSocket; requestBuffer = socket.HeaderReceiver.RequestHeader.TmphBuffer; responseBuffer = socket.Buffer; onReceiveRequestHandle = onReceiveRequest; onReceiveResponseHandle = onReceiveResponse; onSendResponseHandle = onSendResponse; }