Listing 1. Conversion of Windows Socket Calls

#ifdef LINUX
   #include <sys/socket.h>
#else
   #include <windows.h>
   #include <winsock.h>
#endif

#ifdef LINUX
   long socket_get_cvt (SOCK_STREAM sock, int *socket_ok);
#else
   long socket_get_cvt (SOCKET sock, int *socket_ok);
#endif

#ifdef LINUX
  SOCK_STREAM sock;  // socket handle
#else
  SOCKET sock;       // socket handle
  WSADATA wsaData;   // winsocket data structure
#endif