public void SendRequest(MyWebRequest request) { ResponseUri = request.RequestUri; request.Header = request.Method + " " + ResponseUri.PathAndQuery + " HTTP/1.0\r\n" + request.Headers; socket.Send(Encoding.ASCII.GetBytes(request.Header)); }
public void Connect(MyWebRequest request) { ResponseUri = request.RequestUri; socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); IPEndPoint remoteEP = new IPEndPoint(Dns.Resolve(ResponseUri.Host).AddressList[0], ResponseUri.Port); socket.Connect(remoteEP); }
public static MyWebRequest Create(Uri uri, MyWebRequest AliveRequest, bool bKeepAlive) { if (bKeepAlive && AliveRequest != null && AliveRequest.response != null && AliveRequest.response.KeepAlive && AliveRequest.response.socket.Connected && AliveRequest.RequestUri.Host == uri.Host) { AliveRequest.RequestUri = uri; return(AliveRequest); } return(new MyWebRequest(uri, bKeepAlive)); }
public static MyWebRequest Create(Uri uri, MyWebRequest AliveRequest, bool bKeepAlive) { if (bKeepAlive && AliveRequest != null && AliveRequest.response != null && AliveRequest.response.KeepAlive && AliveRequest.response.socket.Connected && AliveRequest.RequestUri.Host == uri.Host) { AliveRequest.RequestUri = uri; return AliveRequest; } return new MyWebRequest(uri, bKeepAlive); }