WriteByte Method  
 

Write a byte of data to the socket.

Syntax

object.WriteByte( Value )

Parameters

Value
A byte or integer value that specifies the data that should be sent to the remote host. If this parameter is a numeric value, it will be converted to its equivalent byte value and written to the socket. If the argument is a string, the first character will be written to the socket.

Return Value

This method returns a Boolean value. If the byte of data was successfully written to the socket, the method will return True. If the data could not be written to the socket, the method will return False and the application should check the value of the LastError property to determine the exact cause of the failure.

Remarks

The WriteByte method writes a single byte of data to the socket. If the connection is buffered, as is typically the case, the data is copied to the send buffer and control immediately returns to the program. If the socket is non-blocking and is out of buffer space, an error will be generated. If the socket is blocking, the application will wait until the data can be sent.

If you use the WriteByte method with a datagram socket, the datagram will only be a single byte in length. You cannot use multiple calls to WriteByte to compose a single datagram.

See Also

IsWritable Property, Timeout Property, Read Method, ReadByte Method, Write Method, OnWrite Event