/// <summary> /// 构造函数 /// </summary> /// <param name="handler">数据包处理器</param> /// <param name="monitor">数据包监测器</param> /// <param name="connectionString">数据连接字符串</param> public TdsClient(IPacketHandler handler, IPacketMonitor monitor, string connectionString) { this.handler = handler; this.connectionString = connectionString; dbAccess = new DbAccess(connectionString); isOpen = false; this.monitor = monitor; monitor.Register(handler); }
/// <summary> /// 构造函数 /// </summary> /// <param name="channelHandler">通道的数据包处理器</param> /// <param name="monitor">数据包处理器监测器</param> internal SingleChannelClient(IPacketHandler channelHandler, IPacketMonitor monitor) { this.channelHandler = channelHandler; isOpen = true; key = channelHandler.Key; iv = channelHandler.IV; this.monitor = monitor; connectDelegate = Connect; sendDelegate = Send; receiveDelegate = Receive; }
/// <summary> /// 构造函数 /// </summary> /// <param name="channelHandler1">通道1的数据包处理器</param> /// <param name="channelHandler2">通道2的数据包处理器</param> /// <param name="monitor">数据包处理器监测器</param> internal DoubleChannelClient(IPacketHandler channelHandler1, IPacketHandler channelHandler2, IPacketMonitor monitor) { this.channelHandler1 = channelHandler1; this.channelHandler2 = channelHandler2; isOpen = true; key = channelHandler1.Key; iv = channelHandler1.IV; this.monitor = monitor; connectDelegate = Connect; sendByChannel1Delegate = SendByChannel1; sendByChannel2Delegate = SendByChannel2; receiveByChannel1Delegate = ReceiveByChannel1; receiveByChannel2Delegate = ReceiveByChannel2; }