#ifdef _WIN32
  #define WIN32_LEAN_AND_MEAN
  #include <windows.h>
  #include <winsock.h>
  #define ECONNREFUSED WSAECONNREFUSED
  #define MAXHOSTNAMELEN 256
#else
  #include <sys/types.h>
  #include <sys/socket.h>
  #include <sys/time.h>
  #include <netinet/in.h>
  #include <netdb.h>
  #define INVALID_SOCKET -1
  #define AF_NETBIOS 17
#endif

#define csock_AF_INET AF_INET
#define csock_PF_INET PF_INET
#define csock_MAXHOSTNAMELEN MAXHOSTNAMELEN
#define csock_SOCK_STREAM SOCK_STREAM
#define csock_SOCK_DGRAM SOCK_DGRAM
#define csock_NULL NULL
#define csock_INVALID_SOCKET INVALID_SOCKET
#define csock_SOL_SOCKET SOL_SOCKET
#define csock_SO_DONTLINGER SO_DONTLINGER

#define csock_accept accept
#define csock_bind bind
#ifdef _WIN32
  #define csock_close closesocket
#else
  #define csock_close close
#endif
#define csock_connect connect
#define csock_gethostname gethostname
#define csock_listen listen
#define csock_read recv
#define csock_sendto sendto
#define csock_setsockopt
#define csock_socket socket
#define csock_write send

cstring csock_error_message();
cint csock_finalize();
cint csock_host_address_to_name(cstring, cstring);
cint csock_host_name_to_address(cstring, cstring);
cint csock_initialize();
cint csock_local_address(cint, cstring);
cstring csock_local_address_family(cint);
cint csock_local_port_number(cint);
cint csock_make_socket_addr(cstring, cint, cint);
cint csock_peer_address(cint, cstring);
cstring csock_peer_address_family(cint);
cint csock_peer_port_number(cint);
cint csock_port_number_for(cstring);
cint csock_port_number_to_name(cint, cstring);
cint csock_readable(cint*, cint);
cint csock_sizeof_sockaddr(cint);
cint csock_udp_read(cint, cstring, cstring, cint*);
cint csock_writeable(cint*, cint);
