ReadByte Method  
 

Read a byte of data from the socket.

Syntax

object.ReadByte

Parameters

None.

Return Value

The integer value of the byte read from the socket. If an error occurs, the method will return a value of -1 and the program should check the value of the LastError property to determine the specific cause of the error.

Remarks

The ReadByte method returns one byte of data that has been read from the socket. 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 stop until a byte of data is returned by the server or the connection is closed.

Note that you should not use the ReadByte method with a datagram socket. If you do, then only the first byte of the datagram will be returned and the remaining data will be discarded. When reading data from a datagram socket, it is recommended that you always use the Read method with the length argument specifying the maximum size of the datagram.

See Also

IsReadable Property, Timeout Property, Read Method, Write Method, WriteByte Method, OnRead Event