Ejemplo n.º 1
0
        public OneWaySocketTunnel(ITunnelCallback callback,
                                  Socket inputSocket, Socket outputSocket, Int32 readBufferSize,
                                  MessageLogger messageLogger, IDataLogger dataLogger)
        {
            this.callback     = callback;
            this.inputSocket  = inputSocket;
            this.outputSocket = outputSocket;

            this.readBufferSize = readBufferSize;

            this.messageLogger = messageLogger;
            this.dataLogger    = dataLogger;

            this.keepRunning = false;
        }
        public SocketToStream(ITunnelCallback callback, Socket readSocket, Stream writeStream, Int32 bufferSize)
        {
            this.callback = callback;

            if (readSocket == null)
            {
                throw new ArgumentNullException("readSocket");
            }
            if (writeStream == null)
            {
                throw new ArgumentNullException("writeStream");
            }

            this.readSocket  = readSocket;
            this.writeStream = writeStream;

            this.bufferSize = bufferSize;
        }
        public SocketToTextWriter(ITunnelCallback callback, Encoding encoding,
                                  Socket socket, TextWriter writer, Int32 socketBufferSize)
        {
            if (encoding == null)
            {
                throw new ArgumentNullException("encoding");
            }
            if (socket == null)
            {
                throw new ArgumentNullException("socket");
            }
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }

            this.callback = callback;

            this.encoding = encoding;
            this.socket   = socket;
            this.writer   = writer;

            this.socketBufferSize = socketBufferSize;
        }
        public TextReaderToSocket(ITunnelCallback callback, Encoding encoding,
                                  TextReader reader, Socket writeSocket, Int32 charBufferSize)
        {
            this.callback = callback;

            if (encoding == null)
            {
                throw new ArgumentNullException("encoding");
            }
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }
            if (writeSocket == null)
            {
                throw new ArgumentNullException("writeSocket");
            }

            this.encoding    = encoding;
            this.reader      = reader;
            this.writeSocket = writeSocket;

            this.charBufferSize = charBufferSize;
        }