public ITcpConnection ConnectTo(Guid connectionId, IPEndPoint remoteEndPoint, TimeSpan connectionTimeout, Action <ITcpConnection> onConnectionEstablished = null, Action <ITcpConnection, SocketError> onConnectionFailed = null, bool verbose = true) { Ensure.NotNull(remoteEndPoint, "remoteEndPoint"); return(TcpConnection.CreateConnectingTcpConnection(connectionId, remoteEndPoint, this, connectionTimeout, onConnectionEstablished, onConnectionFailed, verbose)); }
private ITcpConnection CreateTcpConnection(IPEndPoint endPoint) { Log.Info("TcpBusClientSide.CreateTcpConnection(" + endPoint.Address + ":" + endPoint.Port + ") entered."); var clientTcpConnection = TcpConnection.CreateConnectingTcpConnection(Guid.NewGuid(), endPoint, new TcpClientConnector(), TimeSpan.FromSeconds(120), conn => { Log.Info("TcpBusClientSide.CreateTcpConnection(" + endPoint.Address + ":" + endPoint.Port + ") successfully constructed TcpConnection."); ConfigureTcpListener(); }, (conn, err) => { HandleError(conn, err); }, verbose: true); return(clientTcpConnection); }
private ITcpConnection CreateTcpConnection(EndPoint endPoint) { Log.Info($"TcpBusClientSide.CreateTcpConnection({endPoint}) entered."); var clientTcpConnection = TcpConnection.CreateConnectingTcpConnection( Guid.NewGuid(), endPoint, new TcpClientConnector(), TimeSpan.FromSeconds(120), conn => { Log.Debug($"TcpBusClientSide.CreateTcpConnection({endPoint}) successfully constructed TcpConnection."); IsConnected = true; ConfigureTcpListener(conn); }, (conn, err) => { IsConnected = false; HandleError(conn, err); }, verbose: true); return(clientTcpConnection); }