Example #1
0
        internal FtpDataStream(FtpWebRequest request, Socket socket, bool isRead)
        {
            if (request == null)
            {
                throw new ArgumentNullException("request");
            }
            if (socket == null)
            {
                throw new ArgumentNullException("socket");
            }
            if (!socket.Connected)
            {
                throw new ArgumentException("socket");
            }

            this.request       = request;
            this.socket        = socket;
            this.networkStream = new NetworkStream(socket, true);
            this.isRead        = isRead;

            if (request.EnableSsl)
            {
                FtpWebRequest.ChangeToSSLSocket(ref networkStream);
            }
        }