Name
ReceiveData -- receive bytes from connection (V8.0)
Synopsis
int error = ReceiveData(APTR handle, APTR buf, int size, int *n, struct
                            hwTagList *tags);
Function
Hollywood will call this function to ask your network adapter to copy size bytes from the connection specified by handle to the memory buffer specified by buf. Upon returning, your implementation of ReceiveData() has to write the number of bytes copied to buf to n. Note that returning less than size bytes in n isn't considered an error by Hollywood. Even a value of 0 in n isn't considered an error by Hollywood. It just indicates that there is currently no data to receive in the connection.

To indicate an error, your implementation of ReceiveData() has to return an error code. This can be a custom error registered through hw_RegisterError() or one of Hollywood's predefined error codes (see hollywood/errors.h). The following predefined error codes have a special meaning:

ERR_RECVCLOSED:
Return this error code if the connection was closed by the remote host.

ERR_RECVTIMEOUT:
Return this error code if a timeout has been hit.

Starting with Hollywood 9.0, ReceiveData() may return -1 to indicate that all data has been transferred. This must only be done by plugins which have taken over protocol handling completely by setting HWOPENCONNTAG_CUSTOMPROTOCOL to True in OpenConnection(). See OpenConnection for details. For such plugins, Hollywood will keep calling ReceiveData() until it returns -1 to signal that all data has been transferred.

Inputs
handle
connection handle returned by OpenConnection()
buf
memory buffer to copy bytes to
size
number of bytes to copy to memory buffer
n
number of bytes copied to buffer
tags
reserved for future use (currently NULL)
Results
error
error code or 0 for success

Show TOC