Read Method  
 

Return data read from the server.

Syntax

object.Read( Buffer, [Length] )

Parameters

Buffer
A buffer that the data will be stored in. If the variable is a String then the data will be returned as a string of characters. If the data returned by the server contains UTF-8 encoded text, it will automatically be converted to standard UTF-16 Unicode text. If you wish to read the data without conversion, provide a Byte array as the buffer.
Length
A numeric value which specifies the number of bytes to read. Its maximum value is 231-1 = 2147483647. This argument is required to be present for string data. If a value is specified for this argument for other permissible types of data, and it is less than number of bytes that is determined by the control, then Length will override the internally computed value. If the argument is omitted, then the maximum number of bytes to read is determined by the size of the buffer.

Return Value

The number of bytes actually read from the server is returned by this method. If an error occurs, a value of -1 is returned.

Remarks

The Read method returns data that has been read from the server, up to the number of bytes specified. If no data is available to be read, an error will be generated if the control is non-blocking mode. If the control is in blocking mode, the program will wait until data is returned by the server or the connection is closed.

See Also

IsConnected Property, IsReadable Property, Write Method, OnRead Event, OnWrite Event