SocketTools .NET Edition

TelnetClient.Read Method (String)

Read data from the server and store it in a string.

[Visual Basic]
Overloads Public Function Read( _
   ByRef buffer As String _
) As Integer
[C#]
public int Read(
   ref string buffer
);

Parameters

buffer
A string that will contain the data read from the client.

Return Value

An integer value which specifies the number of bytes actually read from the server. A return value of zero specifies that the remote host has closed the connection and there is no more data available to be read. If an error occurs, a value of -1 is returned and the application should check the value of the LastError property to determine the cause of the failure.

Remarks

The Read method returns data that has been read from the server, up to a maximum of 4096 bytes. If no data is available to be read, an error will be generated if the client is in non-blocking mode. If the client is in blocking mode, the program will stop until data is received from the server or the connection is closed.

This method should only be used if the remote host is sending data that consists of printable characters. Binary data should be read using the method that accepts a byte array as the buffer parameter.

See Also

TelnetClient Class | SocketTools Namespace | TelnetClient.Read Overload List