udp_get_socket listener function

I have been using TCPnet for ST10 but I imagine my question applies cross-platform.

The documentation for udp_get_socket specifies that a user-defined listener callback should be registered as below:

#include <AR166.h>

U8 udp_get_socket (
    U8   tos,           /* Type Of Service. */
    U8   opt,           /* Option to calculate or verify the checksum. */
    U16 (*listener)(    /* Function to call when TCPnet receives a data packet. */
        U8  socket,     /* Socket handle of the local machine. */
        U8* remip,      /* Pointer to IP address of remote machine. */
        U16 port,       /* Port number of remote machine. */
        U8* buf,        /* Pointer to buffer containing the received data. */
        U16 len ));     /* Number of bytes in the received data packet. */

I cannot find documentation about a few aspects of the listener function:

- Is it the responsibility of the udp_get_socket listener function to free the buffer memory, or does the listener caller take care of that?
- What significance does the U16 return value of the listener function have? What does the caller do with the return value?

Thanks, Tony

Parents Reply Children
More questions in this forum