1 int sockbindopt(char *host, char *serv, int prot, int type, int reuse)
3 struct addrinfo hint, *addr, *save;
6 char buf[INET6_ADDRSTRLEN];
8 while (addr != NULL) { /* loop on possible addresses */
10 sock = socket(addr->ai_family, addr->ai_socktype, addr->ai_protocol);
12 /* connect the socket */
13 if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
14 &reuse, sizeof(reuse))) {
15 printf("error on socket options\n");