System.Net.Security.SslStream.Read C# (CSharp) Method

Read() public method

public Read ( byte buffer, int offset, int count ) : int
buffer byte
offset int
count int
return int
        public override int Read(byte[] buffer, int offset, int count)
        {
            return _sslState.SecureStream.Read(buffer, offset, count);
        }

Usage Example

Example #1
1
        static void Test()
        {
            // Connect as client to port 1300
            string server = "127.0.0.1";
            TcpClient client = new TcpClient(server, 1300);

            // Create a secure stream
            using (SslStream sslStream = new SslStream(client.GetStream(), false,
                new RemoteCertificateValidationCallback(ValidateServerCertificate), null))
            {
                sslStream.AuthenticateAsClient(server);

                // ... Send and read data over the stream
                byte[] buffer = new byte[1024];
                int n = sslStream.Read(buffer, 0, 1024);


                string _message = System.Text.Encoding.UTF8.GetString(buffer, 0, n);
                System.Console.WriteLine("Client said: " + _message); 

            }

            // Disconnect and close the client
            client.Close();
        }
All Usage Examples Of System.Net.Security.SslStream::Read