win32shim.h 394 B

123456789101112131415161718
  1. #pragma once
  2. #include <winsock2.h>
  3. #define SHUT_RDWR SD_BOTH
  4. #define ssize_t SSIZE_T
  5. #define strcasecmp stricmp
  6. #define strncasecmp _strnicmp
  7. #define bzero(p, n) memset(p, 0, n)
  8. #define usleep(x) Sleep((x) / 1000)
  9. inline size_t read(int sock, char* buf, size_t n) {
  10. return recv(sock, buf, n, 0);
  11. }
  12. inline int write(int sock, const char* buf, size_t n) {
  13. return send(sock, buf, n, 0);
  14. }