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