/// <summary> /// TCP调用客户端 /// </summary> /// <param name="attribute">TCP调用服务器端配置信息</param> /// <param name="onCustomData">自定义数据包处理</param> /// <param name="log">日志接口</param> public TcpOpenClient(AutoCSer.Net.TcpOpenServer.ServerAttribute attribute = null, Action <SubArray <byte> > onCustomData = null, AutoCSer.Log.ILog log = null) { if (attribute == null) { attribute = AutoCSer.Net.TcpOpenServer.ServerAttribute.GetConfig("AutoCSer.TestCase.TcpOpenServerPerformance.OpenServer", typeof(AutoCSer.TestCase.TcpOpenServerPerformance.OpenServer)); } _TcpClient_ = new AutoCSer.Net.TcpOpenServer.Client <TcpOpenClient>(this, attribute, onCustomData, log); if (attribute.IsAutoClient) { _TcpClient_.TryCreateSocket(); } }
/// <summary> /// TCP调用客户端 /// </summary> /// <param name="attribute">TCP调用服务器端配置信息</param> /// <param name="verifyMethod">TCP验证方法</param> /// <param name="onCustomData">自定义数据包处理</param> /// <param name="log">日志接口</param> public TcpOpenClient(AutoCSer.Net.TcpOpenServer.ServerAttribute attribute = null, Func <TcpOpenClient, AutoCSer.Net.TcpOpenServer.ClientSocketSender, bool> verifyMethod = null, Action <SubArray <byte> > onCustomData = null, AutoCSer.Log.ILog log = null) { if (attribute == null) { attribute = AutoCSer.Config.Loader.Get <AutoCSer.Net.TcpOpenServer.ServerAttribute>("AutoCSer.TestCase.ChatServer.Server") ?? AutoCSer.Json.Parser.Parse <AutoCSer.Net.TcpOpenServer.ServerAttribute>(@"{""CheckSeconds"":59,""ClientOutputSleep"":0,""ClientSegmentationCopyPath"":""..\\..\\..\\ChatClient\\"",""ClientSendBufferMaxSize"":0x100000,""ClientTryCreateSleep"":1000,""CommandPoolBitSize"":0x03,""GenericType"":null,""Host"":""127.0.0.1"",""IsAttribute"":true,""IsAutoClient"":true,""IsAutoServer"":true,""IsBaseTypeAttribute"":false,""IsJsonSerialize"":true,""IsMarkData"":false,""IsSegmentation"":true,""IsServerBuildOutputThread"":false,""IsSimpleSerialize"":true,""MaxCustomDataSize"":0x3FF4,""MaxInputSize"":0x3FF4,""MaxVerifyDataSize"":1024,""MemberFilters"":""Instance"",""MinCompressSize"":0,""Name"":null,""Port"":0x3070,""ReceiveBufferSize"":""Kilobyte"",""ReceiveVerifyCommandSeconds"":9,""SendBufferSize"":""Kilobyte"",""ServerOutputSleep"":1,""ServerSendBufferMaxSize"":0,""VerifyString"":null,""TypeId"":{}}"); if (attribute.Name == null) { attribute.Name = "AutoCSer.TestCase.ChatServer.Server"; } } _TcpClient_ = new AutoCSer.Net.TcpOpenServer.Client <TcpOpenClient>(this, attribute, onCustomData, log, verifyMethod); if (attribute.IsAutoClient) { _TcpClient_.TryCreateSocket(); } }