Esempio n. 1
0
        protected BaseConnection(PortListener portBinding, TcpClient tcpClient)
        {
            if (portBinding == null) throw new ArgumentNullException("portBinding");
            if (tcpClient == null) throw new ArgumentNullException("tcpClient");

            PortBinding = portBinding;
            TcpClient = tcpClient;

            ConnectionInitiated = DateTime.UtcNow;
            NetworkStream = tcpClient.GetStream();
            Reader = new StringReaderStream(NetworkStream);
            Writer = new StreamWriter(NetworkStream) { AutoFlush = true };
            RemoteEndPoint = (IPEndPoint)tcpClient.Client.RemoteEndPoint;
        }
Esempio n. 2
0
        protected BaseConnection(PortListener portBinding, TcpClient tcpClient)
        {
            if (portBinding == null)
            {
                throw new ArgumentNullException("portBinding");
            }
            if (tcpClient == null)
            {
                throw new ArgumentNullException("tcpClient");
            }

            PortBinding = portBinding;
            TcpClient   = tcpClient;

            ConnectionInitiated = DateTime.UtcNow;
            NetworkStream       = tcpClient.GetStream();
            Reader = new StringReaderStream(NetworkStream);
            Writer = new StreamWriter(NetworkStream)
            {
                AutoFlush = true
            };
            RemoteEndPoint = (IPEndPoint)tcpClient.Client.RemoteEndPoint;
        }