/// <summary> /// 获取配置信息 /// </summary> /// <param name="serviceName">TCP 调用服务名称</param> /// <param name="type">TCP 服务器类型</param> /// <returns>TCP 调用服务器端配置信息</returns> public static TcpInternalServer.ServerAttribute GetConfig(string serviceName, Type type) { TcpInternalServer.ServerAttribute attribute = (TcpInternalServer.ServerAttribute)AutoCSer.Configuration.Common.Get(typeof(TcpInternalServer.ServerAttribute), serviceName); if (attribute == null && type != null) { ServerAttribute staticAttribute = AutoCSer.Metadata.TypeAttribute.GetAttribute <ServerAttribute>(type, false); AutoCSer.MemberCopy.Copyer <TcpInternalServer.ServerBaseAttribute> .Copy(attribute = new TcpInternalServer.ServerAttribute(), staticAttribute); } if (attribute == null) { attribute = new TcpInternalServer.ServerAttribute(); } if (attribute.Name == null) { attribute.Name = serviceName; } return(attribute); }
/// <summary> /// TCP 内部服务客户端 /// </summary> /// <param name="attribute">TCP服务调用配置</param> /// <param name="onCustomData">自定义数据包处理</param> /// <param name="log">日志接口</param> /// <param name="clientRoute">TCP 客户端路由</param> /// <param name="verifyMethod">验证委托</param> public Client(TcpInternalServer.ServerAttribute attribute, Action <SubArray <byte> > onCustomData, ILog log, AutoCSer.Net.TcpServer.ClientLoadRoute <AutoCSer.Net.TcpInternalServer.ClientSocketSender> clientRoute = null, Func <TcpInternalServer.ClientSocketSender, bool> verifyMethod = null) : base(attribute, onCustomData, log, clientRoute) { this.verifyMethod = verifyMethod; }
public static TcpInternalServer.ServerAttribute GetConfig(string serviceName, Type type, bool isServer) { TcpInternalServer.ServerAttribute attribute = GetConfig(serviceName, type); attribute.IsServer = isServer; return(attribute); }