|
|
@ -2,6 +2,11 @@ |
|
|
|
#define __UTIL_H__ |
|
|
|
#define __UTIL_H__ |
|
|
|
|
|
|
|
|
|
|
|
#if defined(unix) || defined(__APPLE__) |
|
|
|
#if defined(unix) || defined(__APPLE__) |
|
|
|
|
|
|
|
#include <errno.h> |
|
|
|
|
|
|
|
#include <sys/socket.h> |
|
|
|
|
|
|
|
#include <netinet/in.h> |
|
|
|
|
|
|
|
#include <arpa/inet.h> |
|
|
|
|
|
|
|
|
|
|
|
#define SOCKETTYPE int |
|
|
|
#define SOCKETTYPE int |
|
|
|
#define SOCKETFAIL(a) ((a) < 0) |
|
|
|
#define SOCKETFAIL(a) ((a) < 0) |
|
|
|
#define INVSOCK -1 |
|
|
|
#define INVSOCK -1 |
|
|
@ -10,6 +15,9 @@ |
|
|
|
|
|
|
|
|
|
|
|
#define SOCKERRMSG strerror(errno) |
|
|
|
#define SOCKERRMSG strerror(errno) |
|
|
|
#elif defined WIN32 |
|
|
|
#elif defined WIN32 |
|
|
|
|
|
|
|
#include <ws2tcpip.h> |
|
|
|
|
|
|
|
#include <winsock2.h> |
|
|
|
|
|
|
|
|
|
|
|
#define SOCKETTYPE SOCKET |
|
|
|
#define SOCKETTYPE SOCKET |
|
|
|
#define SOCKETFAIL(a) ((a) == SOCKET_ERROR) |
|
|
|
#define SOCKETFAIL(a) ((a) == SOCKET_ERROR) |
|
|
|
#define INVSOCK INVALID_SOCKET |
|
|
|
#define INVSOCK INVALID_SOCKET |
|
|
|