diff options
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/errnomodule.c | 2 | ||||
-rw-r--r-- | Modules/socketmodule.c | 4 | ||||
-rw-r--r-- | Modules/socketmodule.h | 27 |
3 files changed, 18 insertions, 15 deletions
diff --git a/Modules/errnomodule.c b/Modules/errnomodule.c index 227e24b..d5fe460 100644 --- a/Modules/errnomodule.c +++ b/Modules/errnomodule.c @@ -6,7 +6,7 @@ /* Windows socket errors (WSA*) */ #ifdef MS_WINDOWS #define WIN32_LEAN_AND_MEAN -#include <winsock.h> +#include <windows.h> #endif /* diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index 3f94ebc..b948132 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -2628,7 +2628,7 @@ PyDoc_STRVAR(shutdown_doc, Shut down the reading side of the socket (flag == SHUT_RD), the writing side\n\ of the socket (flag == SHUT_WR), or both ends (flag == SHUT_RDWR)."); -#ifdef MS_WINDOWS +#if defined(MS_WINDOWS) && defined(SIO_RCVALL) static PyObject* sock_ioctl(PySocketSockObject *s, PyObject *arg) { @@ -2677,7 +2677,7 @@ static PyMethodDef sock_methods[] = { METH_NOARGS, getsockname_doc}, {"getsockopt", (PyCFunction)sock_getsockopt, METH_VARARGS, getsockopt_doc}, -#ifdef MS_WINDOWS +#if defined(MS_WINDOWS) && defined(SIO_RCVALL) {"ioctl", (PyCFunction)sock_ioctl, METH_VARARGS, sock_ioctl_doc}, #endif diff --git a/Modules/socketmodule.h b/Modules/socketmodule.h index 114084c..a24110f 100644 --- a/Modules/socketmodule.h +++ b/Modules/socketmodule.h @@ -13,20 +13,23 @@ # endif #else /* MS_WINDOWS */ -#if _MSC_VER >= 1300 # include <winsock2.h> # include <ws2tcpip.h> -# include <MSTcpIP.h> /* for SIO_RCVALL */ -# define HAVE_ADDRINFO -# define HAVE_SOCKADDR_STORAGE -# define HAVE_GETADDRINFO -# define HAVE_GETNAMEINFO -# define ENABLE_IPV6 -#else -# define WIN32_LEAN_AND_MEAN -# include <winsock.h> -#endif -#endif +/* VC6 is shipped with old platform headers, and does not have MSTcpIP.h + * Separate SDKs have all the functions we want, but older ones don't have + * any version information. I use IPPROTO_IPV6 to detect a decent SDK. + */ +# ifdef IPPROTO_IPV6 +# include <MSTcpIP.h> /* for SIO_RCVALL */ +# define HAVE_ADDRINFO +# define HAVE_SOCKADDR_STORAGE +# define HAVE_GETADDRINFO +# define HAVE_GETNAMEINFO +# define ENABLE_IPV6 +# else +typedef int socklen_t; +# endif /* IPPROTO_IPV6 */ +#endif /* MS_WINDOWS */ #ifdef HAVE_SYS_UN_H # include <sys/un.h> |