bind
is called for the local address (one you intend to recv
packets to). The IP address must be a local IP address of the machine, or (most frequently) INADDR_ANY
.
Normally you don't have to use bind
on the client side at all. The system will pick a suitable free port for you automatically.
To specify the remote address for a UDP socket, use sendto
, not send
.
If you search Google for udp client c code
, one of the first results is this one. You can see that the networking part is basically just two calls, socket
and sendto
.