Lines Matching refs:fd
81 int fd; in get_socket() local
83 fd = socket(family, proto == IPPROTO_TCP ? SOCK_STREAM : SOCK_DGRAM, in get_socket()
85 if (fd < 0) { in get_socket()
89 return fd; in get_socket()
92 static int bind_device(int fd, const char *interface, void *addr, int len, in bind_device() argument
101 if (setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, in bind_device()
107 setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val)); in bind_device()
116 printf("Socket %d binding to %s\n", fd, in bind_device()
122 printf("Socket %d binding to %s\n", fd, in bind_device()
128 ret = bind(fd, (struct sockaddr *)addr, len); in bind_device()
134 static int receive(int fd, unsigned char *buf, int buflen, in receive() argument
140 ret = recvfrom(fd, buf, buflen, 0, addr, addrlen); in receive()
146 ret = read(fd, buf, buflen); in receive()
159 static int reply(int fd, unsigned char *buf, int buflen, in reply() argument
165 ret = sendto(fd, buf, buflen, 0, addr, addrlen); in reply()
173 ret = write(fd, buf + sent, buflen - sent); in reply()
514 int fd; in main() local
528 fd = MAX(tcp4, tcp6); in main()
533 fd = MAX(fd, accepted4); in main()
538 fd = MAX(fd, accepted6); in main()
541 ret = select(fd + 1, &rfds, NULL, in main()