diff options
Diffstat (limited to 'client/libacron/include/net.h')
-rw-r--r-- | client/libacron/include/net.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/client/libacron/include/net.h b/client/libacron/include/net.h index 6f5619a..7b28df2 100644 --- a/client/libacron/include/net.h +++ b/client/libacron/include/net.h @@ -76,15 +76,22 @@ LIBAC_EXPORT int ac_disconnect(void *connection, bool force); * Blocks the current thread until a new response or event arrives. * @param connection A non-NULL and connected connection passed as-is from ac_connect. * @param buffer Buffer of data read from the socket. + * @param pos Read the buffer starting at pos. * @param len Length to buffer. * @param response Output response of either an event or a response. May be NULL even if it succeeds. + * @param len_read Output the bytes read. Must be <= len. The caller must call it again with pos = *len_read until + * the sum of *len_read == len or when return value == AC_E_AGAIN, except when return value != AC_E_OK. + * Note: if return value == AC_E_AGAIN, call ac_receive with buffer = pos = len = 0 once, regardless of *len_read. + * In this case, len_read is ignored. * @return AC_E_OK or an error code. When failed, *response is NULL. * Notes: if the state is changed to CLOSED after receiving, this function will return AC_E_NET. */ LIBAC_EXPORT int ac_receive(void *connection, const void *buffer, + size_t pos, size_t len, - ac_obj_t **response); + ac_obj_t **response, + size_t *len_read); /** * Get the current state of the connection. |