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); } } }
static Controller() { Instance = new Controller(); Port = NetHelper.GetAvailablePort(DEF_PORT); RpcInvokeProxy = new RpcInvokeProxy(Port); ClientProxy = MethodProxy.CreateProxy <IClient>(RpcInvokeProxy); Log.Info($"Listen port {Port}"); }
public static IClient GetProxy() { var ClientInvoker = new ClientInvoker(); return(MethodProxy.CreateProxy <IClient>(ClientInvoker)); }