X-Git-Url: https://gapil.gnulinux.it/gitweb/?p=gapil.git;a=blobdiff_plain;f=sources%2FSockUtil.c;h=8b3fef219143d48543cb0e2dd49b79651efb8840;hp=28b22defae96326ad406f723a85bea0484316bb2;hb=847a6cd39fe3d885ececc0658dfa5a4862534627;hpb=3ad06e8129067dccfa3fad74e7cf6c051231d150 diff --git a/sources/SockUtil.c b/sources/SockUtil.c index 28b22de..8b3fef2 100644 --- a/sources/SockUtil.c +++ b/sources/SockUtil.c @@ -205,12 +205,11 @@ int sockbind(char *host, char *serv, int prot, int type) * $Id$ * ****************************************************************/ -int sockbind2(char *host, char *serv, int prot, int type) +int sockbindopt(char *host, char *serv, int prot, int type, int reuse) { struct addrinfo hint, *addr, *save; int res; int sock; - int opt=1; char buf[INET6_ADDRSTRLEN]; /* initialize hint structure */ memset(&hint, 0, sizeof(struct addrinfo)); @@ -240,7 +239,8 @@ int sockbind2(char *host, char *serv, int prot, int type) } } /* connect the socket */ - if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt))) { + if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, + &reuse, sizeof(reuse))) { printf("error on socket options\n"); return -1; }