summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'util.c')
-rw-r--r--util.c27
1 files changed, 0 insertions, 27 deletions
diff --git a/util.c b/util.c
index 3c48e71..ae733eb 100644
--- a/util.c
+++ b/util.c
@@ -83,33 +83,6 @@ char *addr2string(struct sockaddr *addr, socklen_t len) {
return addr_buf[i];
}
-int bindport(int type, char *port) {
- struct addrinfo hints, *res0, *res;
- int s, one = 1;
-
- memset(&hints, 0, sizeof(hints));
- hints.ai_socktype = type;
- hints.ai_family = AF_UNSPEC;
- hints.ai_flags = AI_PASSIVE;
-
- if (getaddrinfo(NULL, port, &hints, &res0) != 0) {
- err("bindport: can't resolve port %s", port);
- return -1;
- }
- for (res = res0; res; res = res->ai_next) {
- s = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
- if (s >= 0) {
- setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one));
- if (bind(s, res->ai_addr, res->ai_addrlen) == 0)
- break;
- close(s);
- s = -1;
- }
- }
- freeaddrinfo(res0);
- return s;
-}
-
int connectport(int type, char *host, char *port) {
struct addrinfo hints, *res0, *res;
int s;