Ejemplo n.º 1
0
 public HttpConnection(Uri uri, int sendTimeout, int receiveTimeout,
     int sendBufferSize, int receiveBufferSize)
 {
     Uri = uri;
     _receiveBufferSettings = new Tcp.Params.Buffer() { Size = receiveBufferSize, Timeout = receiveTimeout };
     _sendBufferSettings = new Tcp.Params.Buffer() { Size = sendBufferSize, Timeout = sendTimeout };
     Logger.Network.Debug("HttpConnection ID: " + this.GetHashCode().ToString() + "\r\nHttpConnection created.");
 }
Ejemplo n.º 2
0
 public HttpConnection(Uri uri, Tcp.Params.Buffer receiveBufferSettings, 
     Tcp.Params.Buffer sendBufferSettings)
 {
     Uri = uri;
     _receiveBufferSettings = receiveBufferSettings;
     _sendBufferSettings = sendBufferSettings;
     Logger.Network.Debug("HttpConnection ID: " + this.GetHashCode().ToString() + "\r\nHttpConnection created.");
 }
Ejemplo n.º 3
0
 public HttpConnection(Uri uri, Tcp.Params.Buffer receiveBufferSettings,
                       Tcp.Params.Buffer sendBufferSettings)
 {
     Uri = uri;
     _receiveBufferSettings = receiveBufferSettings;
     _sendBufferSettings    = sendBufferSettings;
     Logger.Network.Debug("HttpConnection ID: " + this.GetHashCode().ToString() + "\r\nHttpConnection created.");
 }
Ejemplo n.º 4
0
 public HttpConnection(Uri uri, int sendTimeout, int receiveTimeout,
                       int sendBufferSize, int receiveBufferSize)
 {
     Uri = uri;
     _receiveBufferSettings = new Tcp.Params.Buffer()
     {
         Size = receiveBufferSize, Timeout = receiveTimeout
     };
     _sendBufferSettings = new Tcp.Params.Buffer()
     {
         Size = sendBufferSize, Timeout = sendTimeout
     };
     Logger.Network.Debug("HttpConnection ID: " + this.GetHashCode().ToString() + "\r\nHttpConnection created.");
 }
Ejemplo n.º 5
0
        //public void Execute(Request request,
        //    Tcp.Params.Buffer receiveBufferSettings, Tcp.Params.Buffer sendBufferSettings)
        //{
        //    Execute(request, receiveBufferSettings, sendBufferSettings);
        //}

        public void Execute(Request request,
                            Tcp.Params.Buffer receiveBufferSettings, Tcp.Params.Buffer sendBufferSettings,
                            HttpConnection.ConnectionDelegate onConnectCallback,
                            HttpConnection.ConnectionDelegate onDisconnectCallback,
                            HttpConnection.ErrorDelegate onErrorCallback,
                            HttpConnection.ProgressDelegate onProgressCallback,
                            HttpConnection.ConnectionDelegate onTimeoutCallback,
                            HttpConnection.CompletionDelegate onCompleteCallback)
        {
            HttpConnection conn;

            conn = new HttpConnection(request.RequestLine.RequestUri, receiveBufferSettings, sendBufferSettings);

            if (onDisconnectCallback != null)
            {
                conn.OnDisconnect += onDisconnectCallback;
            }
            if (onErrorCallback != null)
            {
                conn.OnError += onErrorCallback;
            }
            if (onProgressCallback != null)
            {
                conn.OnProgress += onProgressCallback;
            }
            if (onTimeoutCallback != null)
            {
                conn.OnTimeout += onTimeoutCallback;
            }
            if (onCompleteCallback != null)
            {
                conn.OnComplete += onCompleteCallback;
            }

            conn.OnConnect += delegate(HttpConnection sender)
            {
                if (onConnectCallback != null)
                {
                    onConnectCallback(sender);
                }
                conn.SendRequestAsync(request);
            };

            conn.ConnectAsync();
        }