aboutsummaryrefslogtreecommitdiff
path: root/lib/net.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/net.c')
-rw-r--r--lib/net.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/net.c b/lib/net.c
index 2bb720a4..be69c9a3 100644
--- a/lib/net.c
+++ b/lib/net.c
@@ -56,17 +56,27 @@ int xconnbind(struct addrinfo *ai_arg, int dobind)
return fd;
}
-int xconnect(struct addrinfo *ai)
+int xconnectany(struct addrinfo *ai)
{
return xconnbind(ai, 0);
}
-int xbind(struct addrinfo *ai)
+int xbindany(struct addrinfo *ai)
{
return xconnbind(ai, 1);
}
+void xbind(int fd, const struct sockaddr *sa, socklen_t len)
+{
+ if (bind(fd, sa, len)) perror_exit("bind");
+}
+
+void xconnect(int fd, const struct sockaddr *sa, socklen_t len)
+{
+ if (connect(fd, sa, len)) perror_exit("connect");
+}
+
int xpoll(struct pollfd *fds, int nfds, int timeout)
{
int i;