int socket_send4(int s,const char *buf,unsigned int len,
const char ip[4],uint16 port);
int socket_send6(int s,const char *buf,unsigned int len,
const char ip[16],uint16 port,uint32 scope_id);
int socket_send(int s,const char *buf,unsigned int len,
const char ip[16],uint16 port,uint32 scope_id);
socket_send6 sends len bytes starting at buf in a UDP datagram over the socket s to UDP port port on IPv6 address ip and perhaps using scope_id as outging interface.
For link-local IPv6 (LLU) addresses scope_id specifies the outgoing interface index. socket_id can be queried for the given name of the interface (e.g. "eth0") by means of socket_getifidx. scope_id should normally be set to 0 except for link local IPv6 addresses
socket_send sends len bytes starting at buf in a UDP datagram over the socket s to UDP port port on IP address ip and perhaps using scope_id as outging interface.
You can call socket_send* without calling socket_bind*. This has the effect as first calling socket_bind4 with IP address 0.0.0.0 and port 0 or socket_bind6 with IP address :: and port 0.
int s;
char ip[4];
uint16 p;
s = socket_udp();
socket_bind(s,ip,p);
socket_send(s,"hello, world",12,ip,p,0);