/// <summary> /// new /// </summary> /// <param name="protocol"></param> /// <param name="socketBufferSize"></param> /// <param name="messageBufferSize"></param> /// <param name="millisecondsSendTimeout"></param> /// <param name="millisecondsReceiveTimeout"></param> /// <exception cref="ArgumentNullException">protocol is null</exception> public SocketClient(Protocol.IProtocol <TMessage> protocol, int socketBufferSize, int messageBufferSize, int millisecondsSendTimeout, int millisecondsReceiveTimeout) : base(socketBufferSize, messageBufferSize) { if (protocol == null) { throw new ArgumentNullException("protocol"); } this._protocol = protocol; if (protocol.IsAsync) { this._connectionPool = new AsyncPool(); } else { this._connectionPool = new SyncPool(); } this._millisecondsSendTimeout = millisecondsSendTimeout; this._millisecondsReceiveTimeout = millisecondsReceiveTimeout; this._pendingQueue = new PendingSendQueue(this); this._receivingQueue = new ReceivingQueue(this); this._endPointManager = new EndPointManager(this); this._endPointManager.Connected += this.OnEndPointConnected; this._endPointManager.Already += this.OnEndPointAlready; }
/// <summary> /// new /// </summary> /// <param name="protocol"></param> /// <param name="socketBufferSize"></param> /// <param name="messageBufferSize"></param> /// <param name="millisecondsSendTimeout"></param> /// <param name="millisecondsReceiveTimeout"></param> /// <exception cref="ArgumentNullException">protocol is null</exception> public BaseSocketClient(IProtocol protocol, int socketBufferSize, int messageBufferSize, int millisecondsSendTimeout, int millisecondsReceiveTimeout) : base(socketBufferSize, messageBufferSize) { if (protocol == null) throw new ArgumentNullException("protocol"); this._protocol = protocol; this._millisecondsSendTimeout = millisecondsSendTimeout; this._millisecondsReceiveTimeout = millisecondsReceiveTimeout; this._pendingQueue = new PendingSendQueue(this, millisecondsSendTimeout); }
/// <summary> /// new /// </summary> /// <param name="protocol"></param> /// <param name="socketBufferSize"></param> /// <param name="messageBufferSize"></param> /// <param name="millisecondsSendTimeout"></param> /// <param name="millisecondsReceiveTimeout"></param> /// <exception cref="ArgumentNullException">protocol is null</exception> public BaseSocketClient(IProtocol protocol, int socketBufferSize, int messageBufferSize, int millisecondsSendTimeout, int millisecondsReceiveTimeout) : base(socketBufferSize, messageBufferSize) { if (protocol == null) { throw new ArgumentNullException("protocol"); } this._protocol = protocol; this._millisecondsSendTimeout = millisecondsSendTimeout; this._millisecondsReceiveTimeout = millisecondsReceiveTimeout; this._pendingQueue = new PendingSendQueue(this, millisecondsSendTimeout); }
/// <summary> /// new /// </summary> /// <param name="protocol"></param> /// <param name="socketBufferSize"></param> /// <param name="messageBufferSize"></param> /// <param name="millisecondsSendTimeout"></param> /// <param name="millisecondsReceiveTimeout"></param> /// <exception cref="ArgumentNullException">protocol is null</exception> public BaseSocketClient(Protocol.IProtocol <TResponse> protocol, int socketBufferSize, int messageBufferSize, int millisecondsSendTimeout, int millisecondsReceiveTimeout) : base(socketBufferSize, messageBufferSize) { if (protocol == null) { throw new ArgumentNullException("protocol"); } this._protocol = protocol; this._millisecondsSendTimeout = millisecondsSendTimeout; this._millisecondsReceiveTimeout = millisecondsReceiveTimeout; this._pendingQueue = new PendingSendQueue(this.ScanningPendingRequest); this._receivingCollection = new ReceivingCollection(this.ReceivingTimeout); }
/// <summary> /// new /// </summary> /// <param name="clientProtocolHandlerFactory"></param> /// <param name="socketBufferSize"></param> /// <param name="messageBufferSize"></param> /// <param name="millisecondsSendTimeout"></param> /// <param name="millisecondsReceiveTimeout"></param> /// <exception cref="ArgumentNullException">protocol is null</exception> public SocketClient(ISyncClientProtocolHandlerFactory <ISyncClientProtocolHandler <TMessageInfo, TMessage>, TMessageInfo, TMessage> clientProtocolHandlerFactory, int socketBufferSize, int messageBufferSize, int millisecondsSendTimeout, int millisecondsReceiveTimeout) : base(socketBufferSize, messageBufferSize) { this._protocolHandlerFactory = clientProtocolHandlerFactory ?? throw new ArgumentNullException("protocol"); this._connectionPool = new SyncPool <TMessageInfo, TMessage>(); this._millisecondsSendTimeout = millisecondsSendTimeout; this._millisecondsReceiveTimeout = millisecondsReceiveTimeout; this._pendingQueue = new PendingSendQueue(this); this._receivingQueue = new ReceivingQueue <TMessageInfo, TMessage>(this); this._endPointManager = new EndPointManager <TMessageInfo, TMessage>(this); this._endPointManager.Connected += this.OnEndPointConnected; this._endPointManager.Already += this.OnEndPointAlready; }