private void ConnectAsync_OnHostResolved_OnConnect(Tcp.TcpConnection sender) { _tcpConnection.OnConnect -= ConnectAsync_OnHostResolved_OnConnect; _tcpConnection.OnError -= ConnectAsync_OnHostResolved_OnError; _tcpConnection.OnTimeout -= ConnectAsync_OnHostResolved_OnTimeout; Logger.Network.Debug("HttpConnection ID: " + this.GetHashCode().ToString() + "\r\nTcpConnection ID: " + _tcpConnection.GetHashCode().ToString() + "\r\nHttpConnection connected to remote host."); if (OnConnect != null) { OnConnect(this); } }
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(); }