Beispiel #1
0
        public static void foo()
        {
            RpcTcpServerChannel channel = new RpcTcpServerChannel(8000);

            channel.TransactionCreated += new Action <RpcServerTransaction>(channel_TransactionCreated);
            RpcServiceManager.RegisterServerChannel(channel);

            RpcServiceManager.RegisterRawService(new RpcRouteService());
        }
Beispiel #2
0
        static void Initialize()
        {
            RpcTcpServerChannel channel = new RpcTcpServerChannel(8888);
            RpcDuplexServer     server  = new RpcDuplexServer(channel);

            //
            // 如果Session没有建立成功,如果发起非注册的信令,直接断开连接
            server.BeforeTransactionCreated += new Action <RpcServerTransaction>(
                delegate(RpcServerTransaction tx) {
                if (tx.Connection.Contexts["session"] == null)
                {
                    if (tx.Request.ServiceDotMethod != "DuplexDemoService.Register")
                    {
                        tx.Connection.Disconnect();
                    }
                }
            }
                );
        }