diff options
Diffstat (limited to 'lib/net.c')
-rw-r--r-- | lib/net.c | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -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; |