Reading data |
To receive data via the SSH tunnel you must first obtain the System.IO.Stream associated with the tunnel. You can do this using the IpClientSsh.Stream property.
Example
[C#]
// create new SSH tunnel to specified POP3 server hostname and port
IpClientSsh ssh = new IpClientSsh(sshParams,popHostname, popPort);
// establish connection
ssh.Connect();
// get stream from tunnel
Stream stream = ssh.Stream;
// create StreamReader to read data from tunnel
System.IO.StreamReader reader = new StreamReader(stream);
// read welcome message from POP3 server and write to console
string line = reader.ReadLine();
Console.WriteLine(line);
[VB]
' create new SSH tunnel to specified POP3 server hostname and port
Dim ssh As IpClientSsh = New IpClientSsh(sshParams, popHostname, popPort)
' establish a connection
ssh.Connect
' get stream from tunnel
Dim stream As Stream = ssh.Stream
' create StreamReader to read data from tunnel
Dim reader As System.IO.StreamReader = New StreamReader(stream)
' read welcome message from POP3 server and write to console
Dim Line As String = reader.ReadLine
Console.WriteLine(Line)