NLint nlRead(NLsocket socket, NLvoid *buffer, NLint nbytes) NLint nlWrite(NLsocket socket, const NLvoid *buffer, NLint nbytes)
socket
[in]Specifies a socket.
buffer
[in]Specifies the buffer with data to read/write.
nbytes
[in]Specifies the length of buffer.
nlRead and nlWrite read or write buffer to or from socket. An NL_RELIABLE,
NL_RELIABLE_PACKETS, or NL_MULTICAST socket must be connected with nlConnect
before nlRead or nlWrite will be successfull. If an NL_UNRELIABLE socket is not connected,
then the address must be set before nlWrite, and nlRead will fill in the address of the sender
for each packet read.
NOTES: nlWrite on an NL_RELIABLE (TCP) stream socket may actually write less than nbytes. In that
case, you must call nlWrite again later to send the unsent bytes.
nlWrite on any packet based socket (NL_UNRELIABLE, NL_RELIABLE_PACKETS, NL_BROADCAST, and NL_MULTICAST)
will return '0' if the network buffers are full. In that case, you must try to resend later.
If no error occurs, nlRead and nlWrite return the number of bytes read or written.
Otherwise, a value of NL_INVALID is returned, and the specific error code can be retrieved by calling
nlGetError.
NL_NULL_POINTER : A NULL pointer was passed to the function.
NL_INVALID_SOCKET : The socket is not valid.
NL_BUFFER_SIZE : The buffer is not large enough to hold the packet.
NL_CON_REFUSED : The pending connection on a non-blocking socket has been refused.
NL_CON_PENDING : The pending connection on a non-blocking socket is still pending.
NL_SYSTEM_ERROR : A system Socket error has ocurred. The system error can be retrieved by calling nlGetSystemError.
NL_MESSAGE_END : The connection was closed by the remote computer.
Back to the HawkNL index page
Go directly to the main HawkNL page at Hawk Software
© 2000-2002 Phil Frisbie.