win32shim.h 436 B

123456789101112131415
  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 void close(int sock) { closesocket(sock); }
  10. inline size_t read(int sock, char* buf, size_t n) { return recv(sock, buf, n, 0); }
  11. inline int write(int sock, const char* buf, size_t n) { return send(sock, buf, n, 0); }