示例#1
0
        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));
        }
示例#2
0
        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);
        }
示例#3
0
 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));
 }
示例#4
0
 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);
 }
示例#5
0
        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));
        }
示例#6
0
        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);
        }