Beispiel #1
0
 public TcpChannel(EndPoint endpoint, IPool <byte[]> buffers, IPool <SocketAsyncEventArgs> arguments, int listenBacklog, AddressFamily addressFamily, ITcpReceiver <byte[]> child) : base(buffers, arguments, addressFamily)
 {
     if (listenBacklog < 0)
     {
         throw new ArgumentException("Argument " + nameof(listenBacklog) + " must not be negative.");
     }
     EndPoint = endpoint ?? throw new ArgumentNullException(nameof(endpoint));
     _child   = child ?? throw new ArgumentNullException(nameof(child));
     Bind(endpoint, listenBacklog);
 }
Beispiel #2
0
        private ITcpReceiver GetTcpReceiver(int identifier, int bufferLength, char endOfLine, SynchronizationContext synchronizationContext,
                                            Action <object, int, SynchronizationContext, string> onDataItemReceived, Action <object, byte[], int> onDataReceived)
        {
            ITcpReceiver tcpReceiver = default;

            try
            {
                tcpReceiver = _getTcpReceiver(this, identifier, bufferLength, endOfLine, synchronizationContext, onDataItemReceived, onDataReceived);
            }
            catch (Exception exception)
            {
                if (!Disconnecting)
                {
                    throw new TcpIpReceiverDelegateFailedException(exception);
                }
            }
            return(tcpReceiver);
        }
Beispiel #3
0
 public TcpDecodingReceiver(ITcpReceiver <string> child, System.Text.Encoding encoding) : base(child, encoding)
 {
     _child = child ?? throw new ArgumentNullException(nameof(child));
 }
Beispiel #4
0
 public TcpChannel(EndPoint endpoint, int buffers, int bufferSize, int eventArgs, int listenBacklog, AddressFamily addressFamily, ITcpReceiver <byte[]> child) : this(endpoint, new ByteArrayPool(buffers, bufferSize), new SocketAsyncEventArgsPool(eventArgs), listenBacklog, addressFamily, child)
 {
 }
 public TcpDispatchingReceiver(ITcpReceiver <TForward> child, IDispatcher dispatcher) : base(child, dispatcher)
 {
     _dispatcher = dispatcher ?? throw new ArgumentNullException(nameof(dispatcher));
     _child      = child ?? throw new ArgumentNullException(nameof(child));
 }
 public TcpForwardingReceiver(ITcpReceiver <TOutput> child) : base(child)
 {
 }