# HG changeset patch # User alex # Date 1179241110 0 # Node ID 8fc44b349f59bfd9fc7cbc3070738d65162f5c96 # Parent f5671ebda7cd5a3b856eece3fbba859bfc310590 initial mingw networking support diff -r f5671ebda7cd -r 8fc44b349f59 network.h --- a/network.h Sat May 12 22:17:40 2007 +0000 +++ b/network.h Tue May 15 14:58:30 2007 +0000 @@ -21,16 +21,26 @@ #ifndef NETWORK_H #define NETWORK_H +#ifdef __MINGW32__ +#include +#include + +#define ff_neterrno() WSAGetLastError() +#define FF_NETERROR(err) WSA##err +#define WSAEAGAIN WSAEWOULDBLOCK +#else #include #include #include -#ifdef HAVE_ARPA_INET_H -#include -#endif #include #define ff_neterrno() errno #define FF_NETERROR(err) err +#endif + +#ifdef HAVE_ARPA_INET_H +#include +#endif int ff_socket_nonblock(int socket, int enable); diff -r f5671ebda7cd -r 8fc44b349f59 os_support.c --- a/os_support.c Sat May 12 22:17:40 2007 +0000 +++ b/os_support.c Tue May 15 14:58:30 2007 +0000 @@ -117,10 +117,14 @@ int ff_socket_nonblock(int socket, int enable) { +#ifdef __MINGW32__ + return ioctlsocket(socket, FIONBIO, &enable); +#else if (enable) return fcntl(socket, F_SETFL, fcntl(socket, F_GETFL) | O_NONBLOCK); else return fcntl(socket, F_SETFL, fcntl(socket, F_GETFL) & ~O_NONBLOCK); +#endif } #endif /* CONFIG_NETWORK */