8 #include <sys/select.h> 22 #define INADDR_BROADCAST 0xFFFFFFFF 28 #define AF_UNSPEC PF_UNSPEC 29 #define AF_INET PF_INET 30 #define AF_INET6 PF_INET6 35 #define MSG_OOB 0x0001 36 #define MSG_PEEK 0x0002 37 #define MSG_DONTROUTE 0x0004 38 #define MSG_DONTWAIT 0x0020 46 #define IPPROTO_UDP 17 51 #define SO_REUSEADDR 0x0004 // reuse address 52 #define SO_BROADCAST 0x0020 // broadcast 53 #define SO_LINGER 0x0080 // linger (no effect?) 54 #define SO_OOBINLINE 0x0100 // out-of-band data inline (no effect?) 55 #define SO_SNDBUF 0x1001 // send buffer size 56 #define SO_RCVBUF 0x1002 // receive buffer size 57 #define SO_SNDLOWAT 0x1003 // send low-water mark (no effect?) 58 #define SO_RCVLOWAT 0x1004 // receive low-water mark 59 #define SO_TYPE 0x1008 // get socket type 60 #define SO_ERROR 0x1009 // get socket error 61 #define SO_NBIO 0x1014 // set socket to NON-blocking mode 62 #define SO_BIO 0x1015 // set socket to blocking mode 63 #define SO_NONBLOCK 0x1016 // set/get blocking mode via optval param 70 #define NSN_EWOULDBLOCK 6 200 struct timeval *timeout);
int recv(int sockfd, void *buf, size_t len, int flags)
const char * inet_ntoa(struct in_addr in)
int listen(int sockfd, int backlog)
uint16_t ntohs(uint16_t val)
int getsockname(int sockfd, struct sockaddr *addr, socklen_t *addrlen)
int bind(int sockfd, const struct sockaddr *addr, socklen_t addrlen)
uint32_t ntohl(uint32_t val)
int recvfrom(int sockfd, void *buf, size_t len, int flags, struct sockaddr *src_addr, socklen_t *addrlen)
int inet_aton(const char *cp, struct in_addr *inp)
int send(int sockfd, const void *buf, size_t len, int flags)
int socket(int domain, int type, int protocol)
int setsockopt(int sockfd, int level, int optname, const void *optval, socklen_t optlen)
int getpeername(int sockfd, struct sockaddr *addr, socklen_t *addrlen)
uint16_t htons(uint16_t val)
int accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen)
unsigned short sin_family
int getsockopt(int sockfd, int level, int optname, void *optval, socklen_t *optlen)
int sendto(int sockfd, const void *buf, size_t len, int flags, const struct sockaddr *dest_addr, socklen_t addrlen)
int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout)
int socketclose(int sockfd)
int connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen)
uint32_t htonl(uint32_t val)
int shutdown(int sockfd, int how)