udp_open - opens a UDP socket
int udp_open(struct ipaddr *local, const struct ipaddr *remote);
UDP is an unreliable message-based protocol. The size of the message is limited. The protocol has no initial or terminal handshake. A single socket can be used to different destinations.
This function creates a UDP socket.
IP address passed in local argument will be used to set source IP address in outgoing packets. Also, the socket can be used to receive packets sent to this address. If port in the address is set to zero an ephemeral port will be chosen and filled into the local address.
IP address passed in remote is the default destination for outbound packets. It is used by msend() and mrecv() functions which don't allow for specifying the destination address explicitly. It is also used by udp_send() and udp_sendl() functions if the address parameter of those functions is set to NULL.
Newly created socket handle. On error, it returns -1 and sets errno to one of the values below.
struct ipaddr addr; int rc = ipaddr_local(&addr, NULL, 5555, 0); int s = udp_open(&addr, NULL);