Example #1
0
        public RpcTcpServerConnection(RpcTcpServerChannel channel, RpcTcpSocketConnection sock)
            : base(RpcConnectionMode.Unknown, RpcConnectionDirection.Server)
        {
            _channel = channel;
            _sock    = sock;

            _sock.RequestReceived += new Action <RpcTcpSocketConnection, int, RpcRequest>(
                (socket, seq, request) => {
                RpcTcpServerTransaction tx = new RpcTcpServerTransaction(_channel, this, socket, request, seq);
                OnTransactionCreated(tx);
            }
                );

            _sock.ResponseReceived += new Action <RpcTcpSocketConnection, int, RpcResponse>(
                (socket, seq, response) => {
                RpcTcpTransactionManager.EndTransaction(seq, response);
            }
                );

            _sock.Disconnected += new Action <RpcTcpSocketConnection>(
                (socket) => {
                OnDisconnected();
            }
                );
        }
Example #2
0
        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);
        }