/// <summary> /// TCP调用客户端 /// </summary> /// <param name="attribute">TCP调用服务器端配置信息</param> /// <param name="clientRoute">TCP 客户端路由</param> /// <param name="log">日志接口</param> public TcpOpenStreamClient(AutoCSer.Net.TcpOpenStreamServer.ServerAttribute attribute = null, AutoCSer.Net.TcpServer.ClientLoadRoute<AutoCSer.Net.TcpOpenStreamServer.ClientSocketSender> clientRoute = null, AutoCSer.Log.ILog log = null) { if (attribute == null) { attribute = AutoCSer.Config.Loader.Get<AutoCSer.Net.TcpOpenStreamServer.ServerAttribute>("AutoCSer.Example.TcpOpenStreamServer.ClientTaskAsync") ?? _DefaultServerAttribute_; if (attribute.Name == null) attribute.Name = "AutoCSer.Example.TcpOpenStreamServer.ClientTaskAsync"; } _TcpClient_ = new AutoCSer.Net.TcpOpenStreamServer.Client<TcpOpenStreamClient>(this, attribute, log, clientRoute); if (attribute.IsAutoClient) _TcpClient_.TryCreateSocket(); }
/// <summary> /// TCP调用客户端 /// </summary> /// <param name="attribute">TCP调用服务器端配置信息</param> /// <param name="log">日志接口</param> public TcpOpenStreamClient(AutoCSer.Net.TcpOpenStreamServer.ServerAttribute attribute = null, AutoCSer.Log.ILog log = null) { if (attribute == null) { attribute = AutoCSer.Config.Loader.Get <AutoCSer.Net.TcpOpenStreamServer.ServerAttribute>("AutoCSer.Example.TcpOpenStreamServer.NoAttribute") ?? AutoCSer.Json.Parser.Parse <AutoCSer.Net.TcpOpenStreamServer.ServerAttribute>(@"{""CheckSeconds"":59,""ClientOutputSleep"":-1,""ClientSegmentationCopyPath"":null,""ClientSendBufferMaxSize"":0x100000,""ClientTryCreateSleep"":1000,""GenericType"":null,""Host"":""127.0.0.1"",""IsAttribute"":false,""IsAutoClient"":false,""IsAutoServer"":true,""IsBaseTypeAttribute"":false,""IsClientAwaiter"":false,""IsCompileSerialize"":true,""IsJsonSerialize"":true,""IsMarkData"":false,""IsRemoteExpression"":false,""IsSegmentation"":true,""IsServerBuildOutputThread"":false,""IsSimpleSerialize"":true,""MaxInputSize"":0x3FF4,""MaxVerifyDataSize"":1024,""MemberFilters"":""Instance"",""MinCompressSize"":0,""Name"":null,""Port"":0x3584,""ReceiveBufferSize"":""Kilobyte8"",""ReceiveVerifyCommandSeconds"":9,""RemoteExpressionServerTask"":""Timeout"",""SendBufferSize"":""Kilobyte8"",""ServerOutputSleep"":-1,""ServerSendBufferMaxSize"":0,""ServerTaskType"":""Queue"",""VerifyString"":null,""TypeId"":{}}"); if (attribute.Name == null) { attribute.Name = "AutoCSer.Example.TcpOpenStreamServer.NoAttribute"; } } _TcpClient_ = new AutoCSer.Net.TcpOpenStreamServer.Client <TcpOpenStreamClient>(this, attribute, log); if (attribute.IsAutoClient) { _TcpClient_.TryCreateSocket(); } }