int error = ReceiveData(APTR handle, APTR buf, int size, int *n, struct hwTagList *tags);
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:
ERR_RECVTIMEOUT:
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.
NULL
)