17#define WHO "socket_send"
21 struct sockaddr_in sa;
25 sa.sin_family = AF_INET;
29 return sendto(s,buf,len,0,(
struct sockaddr *)&sa,
sizeof(sa));
34 struct sockaddr_in6 sa;
38 sa.sin6_family = AF_INET6;
39 sa.sin6_scope_id = scope_id;
43 return sendto(s,buf,len,0,(
struct sockaddr *)&sa,
sizeof(sa));
48 struct sockaddr_storage addr;
49 socklen_t len_sas =
sizeof(addr);
51 if (getsockname(s,(
struct sockaddr *)&addr,&len_sas) == -1) {
56 if (addr.ss_family == AF_INET)
64 struct sockaddr_in sa;
68 sa.sin_family = AF_INET;
70 byte_copy((
char *)&sa.sin_addr,4,V4broadcast);
72 return sendto(s,buf,len,0,(
struct sockaddr *)&sa,
sizeof(sa));
int socket_send6(int s, const char *buf, unsigned int len, const char ip[16], uint16 port, uint32 scope_id)
int socket_send4(int s, const char *buf, unsigned int len, const char ip[4], uint16 port)
int socket_broadcast4(int s, const char *buf, unsigned int len, uint16 port)
int socket_send(int s, const char *buf, unsigned int len, const char ip[16], uint16 port, uint32 scope_id)
void uint16_pack_big(char[2], uint16)
void byte_copy(char *, unsigned int, const char *)
void byte_zero(char *, unsigned int)