aboutsummaryrefslogtreecommitdiff
path: root/lib/net.c
blob: 5d3ea4a824716e59fd43c4ae17b96e4d86c0346d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include "toys.h"

int xsocket(int domain, int type, int protocol)
{
  int fd = socket(domain, type, protocol);

  if (fd < 0) perror_exit("socket %x %x", type, protocol);
  return fd;
}

void xsetsockopt(int fd, int level, int opt, void *val, socklen_t len)
{
  if (-1 == setsockopt(fd, level, opt, val, len)) perror_exit("setsockopt");
}