예제 #1
0
 void HandleRequest(RPCRequest Rpc, SerializableAdapter Adapter, TCPConnection Connection)
 {
     if (_Rpcs.ContainsKey(Rpc.GetType()))
     {
         RPCResponse response = _Rpcs[Rpc.GetType()](Rpc);
         response.RequestId = Rpc.Id;
         Adapter.Send(response, Connection);
     }
 }
예제 #2
0
파일: TCPServer.cs 프로젝트: jascou/ROTNS
 public void Broadcast(RPCRequest Request)
 {
     if (MessageAdapter != null && RPCHandler != null)
     {
         lock (_Connections)
         {
             _Connections.ForEach(i => RPCHandler.Call(Request, MessageAdapter, i));
         }
     }
 }
예제 #3
0
        public Promise Call(RPCRequest Request, SerializableAdapter Adapter, TCPConnection Connection)
        {
            Promise p = new Promise();

            _Promises.Add(_NextId, p);
            Request.Id = _NextId;
            _NextId++;
            Adapter.Send(Request, Connection);
            return(p);
        }
예제 #4
0
파일: TCPClient.cs 프로젝트: jascou/ROTNS
 public Promise Call(RPCRequest Request)
 {
     if (RPCHandler != null && MessageAdapter != null)
     {
         return(RPCHandler.Call(Request, MessageAdapter, _Connection));
     }
     else
     {
         throw new InvalidOperationException("No RPC or Message Adapter provided.");
     }
 }