コード例 #1
0
        public void TestClientAbandon()
        {
            Guid iid = Guid.NewGuid();
            using (RpcServerApi server = new RpcServerApi(iid))
            {
                server.AddProtocol(RpcProtseq.ncalrpc, "lrpctest", 5);
                server.AddAuthentication(RpcAuthentication.RPC_C_AUTHN_WINNT);
                server.StartListening();
                server.OnExecute +=
                    delegate(IRpcClientInfo client, byte[] arg)
                    { return arg; };

                {
                    RpcClientApi client = new RpcClientApi(iid, RpcProtseq.ncalrpc, null, "lrpctest");
                    client.AuthenticateAs(null, RpcClientApi.Self, RpcProtectionLevel.RPC_C_PROTECT_LEVEL_PKT_PRIVACY, RpcAuthentication.RPC_C_AUTHN_WINNT);
                    client.Execute(new byte[0]);
                    client = null;
                }

                GC.Collect(0, GCCollectionMode.Forced);
                GC.WaitForPendingFinalizers();

                server.StopListening();
            }
        }
コード例 #2
0
        public void TestClientAbandon()
        {
            var iid = Guid.NewGuid();

            using (RpcServerApi server = new RpcServerApi(iid))
            {
                server.AddProtocol(RpcProtseq.ncalrpc, "lrpctest", 5);
                server.AddAuthentication(RpcAuthentication.RPC_C_AUTHN_WINNT);
                server.StartListening();
                server.OnExecute +=
                    delegate(IRpcClientInfo client, byte[] arg)
                { return(arg); };

                {
                    RpcClientApi client = new RpcClientApi(iid, RpcProtseq.ncalrpc, null, "lrpctest");
                    client.AuthenticateAs(null, RpcClientApi.Self, RpcProtectionLevel.RPC_C_PROTECT_LEVEL_PKT_PRIVACY, RpcAuthentication.RPC_C_AUTHN_WINNT);
                    client.Execute(new byte[0]);
                    client = null;
                }

                GC.Collect(0, GCCollectionMode.Forced);
                GC.WaitForPendingFinalizers();

                server.StopListening();
            }
        }
コード例 #3
0
ファイル: JobRpcServerTest.cs プロジェクト: git-thinh/corel
        public override void f_STOP()
        {
            if (server != null)
            {
                server.StopListening();

                GC.Collect(0, GCCollectionMode.Forced);
                GC.WaitForPendingFinalizers();
            }

            Tracer.WriteLine("J{0}_{1} {2} -> STOP", this.f_getId(), this.Type, this.GetType().Name);
        }
コード例 #4
0
ファイル: Server.cs プロジェクト: fartwhif/ACWatchDog
        private void ServerLoop()
        {
            Guid iid = new Guid(Constants.ACWatchDogInteropId);

            using (RpcServerApi server = new RpcServerApi(iid, 100, ushort.MaxValue, allowAnonTcp: false))
            {
                // Add an endpoint so the client can connect, this is local-host only:
                server.AddProtocol(RpcProtseq.ncalrpc, Constants.ACWatchDogInteropEndpoint, 100);
                // Add the types of authentication we will accept
                server.AddAuthentication(RpcAuthentication.RPC_C_AUTHN_GSS_NEGOTIATE);
                // Subscribe the code to handle requests on this event:
                server.OnExecute += Server_OnExecute;
                // Start Listening
                server.StartListening();
                @continue = true;
                while (@continue)
                {
                    Thread.Sleep(100);
                }
                server.StopListening();
            }
        }
コード例 #5
0
 public override void StopListening()
 {
     _server.OnExecute -= OnExecute;
     _server.StopListening();
 }