public RpcTcpDuplexConnection(RpcTcpClientChannel channel, TcpUri serverUri) : base(RpcConnectionMode.Duplex, RpcConnectionDirection.Client) { _serverUri = serverUri; _socket = new RpcTcpSocketConnection(RpcConnectionDirection.Client); _socket.Disconnected += new Action <RpcTcpSocketConnection>( (socket) => { OnDisconnected(); } ); _socket.RequestReceived += new Action <RpcTcpSocketConnection, int, RpcRequest>( (socket, seq, request) => { var tx = new RpcTcpServerTransaction(_channel, this, socket, request, seq); OnTransactionCreated(tx); } ); _socket.ResponseReceived += new Action <RpcTcpSocketConnection, int, RpcResponse>( (socket, seq, response) => { RpcTcpTransactionManager.EndTransaction(seq, response); } ); _channel = new RpcDuplexCallbackChannel("tcp", serverUri.ToString(), this, channel); }
public RpcTcpSimplexConnection(RpcTcpClientChannel channel, TcpUri serverUri, int concurrentConnection) : base(RpcConnectionMode.Simplex, RpcConnectionDirection.Client) { _channel = channel; _serverUri = serverUri; _connections = new RpcTcpSimplexConnectionWrapper[concurrentConnection]; _lc = new LoopCounter(concurrentConnection); _connectionCount = new ComboClass <int>(0); for (int i = 0; i < concurrentConnection; i++) { var wrapper = new RpcTcpSimplexConnectionWrapper(this); RpcTcpSimplexConnectionManager.AddConnection(wrapper); _connections[i] = wrapper; } }