udp_hookup ( port, rcv_func );Once this is done, the receive function will be handed each packet received:
my_rcv_func ( struct netbuf * );The receive function is called in the context of the network thread, so it is quite possible to cause problems if the handler is poorly written.
In the unlikely event that you no longer want to listen on a given UDP port, call:
udp_unhook ( port );
udp_send ( target_ip, my_port, target_port, buf, count ); udp_broadcast ( my_port, target_port, buf, count );For more details, study the examples in the source code. In particular, note that the receive callback receives a pointer to a netbuf structure. Data contained in this structure should not be modified, but should either be acted on, or copied into a user buffer.
Kyu / [email protected]