*/
#include "nixio.h"
-#include <sys/socket.h>
-#include <netinet/in.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
-#include "nixio.h"
/**
sock->fd = socket(sock->domain, sock->type, sock->protocol);
if (sock->fd < 0) {
- return nixio__perror(L);
+ return nixio__perror_s(L);
}
return 1;
sock->fd = -1;
do {
+#ifndef __WINNT__
res = close(sockfd);
+#else
+ res = closesocket(sockfd);
+#endif
} while (res == -1 && errno == EINTR);
- return nixio__pstatus(L, !res);
+ return nixio__pstatus_s(L, !res);
}
/**
int res;
if (sock && sock->fd != -1) {
do {
+#ifndef __WINNT__
res = close(sock->fd);
+#else
+ res = closesocket(sock->fd);
+#endif
} while (res == -1 && errno == EINTR);
}
return 0;
return luaL_argerror(L, 2, "supported values: both, read, write");
}
- return nixio__pstatus(L, !shutdown(sockfd, how));
+ return nixio__pstatus_s(L, !shutdown(sockfd, how));
}
/* module table */