Пример #1
0
 /// <summary>
 /// Creates instance with the specified proxied class and session.
 /// </summary>
 /// <param name="serviceName">Name of this service on the remote server.</param>
 /// <param name="session">Session to convey proxied method calls over.</param>
 /// <param name="callMessageHandler">Call handler for the RPC session.</param>
 public RpcProxy(string serviceName, RpcSession <TSession, TConfig> session,
                 RpcCallMessageHandler <TSession, TConfig> callMessageHandler) : base(typeof(T))
 {
     ServiceName         = serviceName;
     _callMessageHandler = callMessageHandler;
     _session            = (TSession)session;
 }
Пример #2
0
        /// <summary>
        /// Called when this session is being setup.
        /// </summary>
        protected override void OnSetup()
        {
            base.OnSetup();

            // Determine if this session is running on the server or client to retrieve the worker thread pool.
            if (BaseSocket.Mode == SocketMode.Server)
            {
                Server = (RpcServer <TSession, TConfig>)BaseSocket;
            }
            else
            {
                Client = (RpcClient <TSession, TConfig>)BaseSocket;
            }

            SerializationCache = new SerializationCache(Config);

            RpcCallHandler = new RpcCallMessageHandler <TSession, TConfig>((TSession)this);
            MessageHandlers.Add(RpcCallHandler.Id, RpcCallHandler);
        }