Ejemplo n.º 1
0
        private void ConnectAsync_OnHostResolved(HttpConnection sender, IPHostEntry host)
        {
            Tcp.Params.Connection param;

            param = new Tcp.Params.Connection()
            {
                EndPoint      = new IPEndPoint(_remoteHostEntry.AddressList[0], Uri.Port),
                ReceiveBuffer = _receiveBufferSettings,
                SendBuffer    = _sendBufferSettings
            };

            _tcpConnection = new Tcp.TcpConnection(param);

            _tcpConnection.OnConnect    += new Tcp.TcpConnection.ConnectionDelegate(ConnectAsync_OnHostResolved_OnConnect);
            _tcpConnection.OnDisconnect += new Tcp.TcpConnection.ConnectionDelegate(ConnectAsync_OnHostResolved_OnDisconnect);
            _tcpConnection.OnError      += new Tcp.TcpConnection.ErrorDelegate(ConnectAsync_OnHostResolved_OnError);
            _tcpConnection.OnTimeout    += new Tcp.TcpConnection.ConnectionDelegate(ConnectAsync_OnHostResolved_OnTimeout);

            Logger.Network.Debug("HttpConnection ID: " + this.GetHashCode().ToString() + "\r\nTcpConnection ID: " + _tcpConnection.GetHashCode().ToString() + "\r\nHttpConnection establishing connection to remote host using TcpConnection.");

            _tcpConnection.ConnectAsync();
        }
Ejemplo n.º 2
0
        private void ConnectAsync_OnHostResolved(HttpConnection sender, IPHostEntry host)
        {
            Tcp.Params.Connection param;
                        
            param = new Tcp.Params.Connection() 
            { 
                EndPoint = new IPEndPoint(_remoteHostEntry.AddressList[0], Uri.Port), 
                ReceiveBuffer = _receiveBufferSettings,
                SendBuffer = _sendBufferSettings
            };

            _tcpConnection = new Tcp.TcpConnection(param);

            _tcpConnection.OnConnect += new Tcp.TcpConnection.ConnectionDelegate(ConnectAsync_OnHostResolved_OnConnect);
            _tcpConnection.OnDisconnect += new Tcp.TcpConnection.ConnectionDelegate(ConnectAsync_OnHostResolved_OnDisconnect);
            _tcpConnection.OnError += new Tcp.TcpConnection.ErrorDelegate(ConnectAsync_OnHostResolved_OnError);
            _tcpConnection.OnTimeout += new Tcp.TcpConnection.ConnectionDelegate(ConnectAsync_OnHostResolved_OnTimeout);

            Logger.Network.Debug("HttpConnection ID: " + this.GetHashCode().ToString() + "\r\nTcpConnection ID: " + _tcpConnection.GetHashCode().ToString() + "\r\nHttpConnection establishing connection to remote host using TcpConnection.");

            _tcpConnection.ConnectAsync();
        }