You copied the Doc URL to your clipboard.

6.1.4. udp_open()

This function is defined in inet\udp_open.c and creates a structure in the UDP layer to receive, and pass upwards, UDP packets that match the parameters passed. The foreign host, fhost, and port, fport, can be set to 0 as a wild card, which enables the reception of broadcast datagrams.

The callback handler function is called with a pointer to a received datagram and a copy of the data pointer which is passed to udp_open(). This can be any data the programmer requires, such as a pointer to another function, or a control structure to aid in demultiplexing the received UDP packet.


UDPCONN udp_open(ip_addr fhost,
                 unsigned short fport, 
                 unsigned short lport, 
                 int (*handler)(PACKET, void *),
                 void *data)



Is the foreign host from which you will accept data. It must be set to 0 if listening for any host.


Is the foreign port number. It must be set to 0 if listening for datagrams from any foreign port.


Is the local port on which to receive data.


Is the UDP receive callback function.


Is the data that is passed (along with the received UDP datagram) to the callback handler.

Return value

Returns one of the following:


A UDP connection identifier if successful. This handle must be passed to udp_close() when the connection is no longer required.


If not successful.

Was this page helpful? Yes No