18 struct sockaddr_in sa;
21 sa.sin_family = AF_INET;
25 return bind(s,(
struct sockaddr *)&sa,
sizeof(sa));
31 setsockopt(s,SOL_SOCKET,SO_REUSEADDR,&opt,
sizeof(opt));
38 while (size >= 1024) {
39 if (setsockopt(s,SOL_SOCKET,SO_RCVBUF,&size,
sizeof(size)) == 0)
return;
46 struct sockaddr_in6 sa;
49 sa.sin6_family = AF_INET6;
53 sa.sin6_scope_id = scope_id;
55 return bind(s,(
struct sockaddr *)&sa,
sizeof(sa));
61 setsockopt(s,SOL_SOCKET,SO_REUSEADDR,&opt,
sizeof(opt));
int socket_bind(int s, const char ip[16], uint16 port, uint32 scope_id)
int socket_bind4(int s, const char ip[4], uint16 port)
int socket_bind4_reuse(int s, const char ip[4], uint16 port)
int socket_bind6_reuse(int s, const char ip[16], uint16 port, uint32 scope_id)
void socket_tryreservein(int s, int size)
int socket_bind6(int s, const char ip[16], uint16 port, uint32 scope_id)
int socket_bind_reuse(int s, const char ip[16], uint16 port, uint32 scope_id)
void uint16_pack_big(char[16], uint16)
#define ip6_isv4mapped(ip)
void byte_copy(void *, unsigned int, const void *)
void byte_zero(void *, unsigned int)