/// <summary> /// TCP调用服务端 /// </summary> /// <param name="attribute">配置信息</param> /// <param name="verify">验证接口</param> /// <param name="isStart">是否启动连接</param> public tcpClient(fastCSharp.setup.cSharp.tcpServer attribute, fastCSharp.setup.cSharp.tcpBase.ITcpVerifyClient verify = null, bool isStart = true) { this.attribute = attribute; if (attribute.TcpRegisterName != null) { if (fastCSharp.setup.tcpRegister.client.Get(attribute.TcpRegisterName).GetRegister(attribute)) { errorServiceName = null; } else { if (errorServiceName != attribute.ServiceName) { log.Default.Add(attribute.ServiceName + " 未找到注册服务信息", false, false); } errorServiceName = attribute.ServiceName; } } this.verify = verify; data = new byte[sizeof(long)]; if (isStart) { start(); } }
/// <summary> /// 客户端TCP调用池 /// </summary> /// <param name="attribute">TCP调用服务器端配置信息</param> /// <param name="isStart">是否启动连接</param> /// <param name="serviceName">服务名称</param> /// <param name="verify">TCP验证实例</param> public clientPool(fastCSharp.setup.cSharp.tcpServer attribute, bool isStart, string serviceName = null, fastCSharp.setup.cSharp.tcpBase.ITcpVerifyClient verify = null) { this.attribute = attribute; this.serviceName = serviceName; this.verify = verify; this.isStart = isStart; maxCount = attribute.MaxClientCount < 2 ? 2 : attribute.MaxClientCount; fastCSharp.threading.task.Default.Add(createClient, onClientError); }
/// <summary> /// TCP调用客户端 /// </summary> /// <param name="attribute">TCP调用服务器端配置信息</param> /// <param name="verify">TCP验证实例</param> /// <param name="isStart">是否启动连接</param> public tcpServerSegmentation(fastCSharp.setup.cSharp.tcpServer attribute = null, fastCSharp.setup.cSharp.tcpBase.ITcpVerifyClient verify = null, bool isStart = true) { _tcpClient_ = new fastCSharp.net.tcpClient(attribute ?? fastCSharp.setup.cSharp.tcpServer.GetConfig("tcpServerSegmentation", typeof(fastCSharp.testCase.tcpServerSegmentation)), verify, isStart); }