Page Not Found
We could not find what you were looking for.
Please contact the owner of the site that linked you to the original URL and let them know their link is broken.
diff --git "a/examples/TouchRpc\347\256\200\345\215\225\347\244\272\344\276\213/TouchRpc\345\267\245\345\216\202\347\244\272\344\276\213/RpcFactoryConsoleApp/Program.cs" "b/examples/TouchRpc\347\256\200\345\215\225\347\244\272\344\276\213/TouchRpc\345\267\245\345\216\202\347\244\272\344\276\213/RpcFactoryConsoleApp/Program.cs" index 28bf5c54e17f1b992881738d9dcb3c62890e97f6..dda005f713cf540df579cc8f6022e64a4a693d14 100644 --- "a/examples/TouchRpc\347\256\200\345\215\225\347\244\272\344\276\213/TouchRpc\345\267\245\345\216\202\347\244\272\344\276\213/RpcFactoryConsoleApp/Program.cs" +++ "b/examples/TouchRpc\347\256\200\345\215\225\347\244\272\344\276\213/TouchRpc\345\267\245\345\216\202\347\244\272\344\276\213/RpcFactoryConsoleApp/Program.cs" @@ -8,12 +8,45 @@ namespace RpcFactoryConsoleApp { static void Main(string[] args) { - Console.WriteLine("Hello, World!"); + var clientFactory = CreateTcpClientFactory(); + + var client = clientFactory.GetTransferClient(); + + try + { + //client.Invoke();//这里可以让得到的通讯单体进行业务交流 + } + finally + { + //重中之重,必须要释放单体 + clientFactory.ReleaseTransferClient(client); + } + } + + private static TcpTouchRpcClientFactory CreateTcpClientFactory() + { + var clientFactory = new TcpTouchRpcClientFactory() + { + MinCount = 5,//最小数量,在主连接器成功建立以后,会检测可用连接是否大于该值,否的话会自动建立。 + MaxCount = 10,//最大数量,当超过该数量的连接后,会等待指定时间,或者永久等待。 + OnGetTransferConfig = () => //配置辅助通信 + { + return new TouchSocketConfig() + .SetRemoteIPHost("tcp://127.0.0.1:7789"); + } + }; + + clientFactory.MainConfig + .SetRemoteIPHost("tcp://127.0.0.1:7789");//配置主通信 + + //检测主通信器连接,然后如果没有连接,会自动建立连接 + Result result = clientFactory.CheckStatus(); + return clientFactory; } - private static TcpTouchRpcClientFactory CreateClientFactory() + private static HttpTouchRpcClientFactory CreateHttpClientFactory() { - TcpTouchRpcClientFactory clientFactory = new TcpTouchRpcClientFactory() + var clientFactory = new HttpTouchRpcClientFactory() { MinCount = 5,//最小数量,在主连接器成功建立以后,会检测可用连接是否大于该值,否的话会自动建立。 MaxCount = 10,//最大数量,当超过该数量的连接后,会等待指定时间,或者永久等待。 @@ -27,6 +60,7 @@ namespace RpcFactoryConsoleApp clientFactory.MainConfig .SetRemoteIPHost("tcp://127.0.0.1:7789");//配置主通信 + //检测主通信器连接,然后如果没有连接,会自动建立连接 Result result = clientFactory.CheckStatus(); return clientFactory; } diff --git a/handbook/build/404.html b/handbook/build/404.html index 795e41ebf9afae25d1456ae2936701cb4d36bcc3..1ef8f2c57d96cef6473f0e7cbf1312a85069bd01 100644 --- a/handbook/build/404.html +++ b/handbook/build/404.html @@ -4,13 +4,13 @@
We could not find what you were looking for.
Please contact the owner of the site that linked you to the original URL and let them know their link is broken.