예제 #1
0
 public static void Connect(int Port = -1)
 {
     if (Port <= 0)
     {
         Port = DEF_PORT;
     }
     try
     {
         RpcInvokeProxy = new RpcInvokeProxy(Port);
         ServerProxy    = MethodProxy.CreateProxy <IService>(RpcInvokeProxy);
     }
     catch
     {
         if (Port != DEF_PORT)
         {
             try
             {
                 RpcInvokeProxy = new RpcInvokeProxy(DEF_PORT);
                 ServerProxy    = MethodProxy.CreateProxy <IService>(RpcInvokeProxy);
             }
             catch
             {
                 ConnectFail(DEF_PORT);
             }
         }
         else
         {
             ConnectFail(Port);
         }
     }
 }
예제 #2
0
 static Controller()
 {
     Instance       = new Controller();
     Port           = NetHelper.GetAvailablePort(DEF_PORT);
     RpcInvokeProxy = new RpcInvokeProxy(Port);
     ClientProxy    = MethodProxy.CreateProxy <IClient>(RpcInvokeProxy);
     Log.Info($"Listen port {Port}");
 }
예제 #3
0
        public static IClient GetProxy()
        {
            var ClientInvoker = new ClientInvoker();

            return(MethodProxy.CreateProxy <IClient>(ClientInvoker));
        }