Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 272cb40

Browse files
committed
Patch #520062: Support IPv6 with VC.NET.
1 parent 31e233a commit 272cb40

3 files changed

Lines changed: 17 additions & 0 deletions

File tree

Modules/socketmodule.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,8 +409,11 @@ PyGAI_Err(int error)
409409
{
410410
PyObject *v;
411411

412+
#ifdef EAI_SYSTEM
413+
/* EAI_SYSTEM is not available on Windows XP. */
412414
if (error == EAI_SYSTEM)
413415
return PySocket_Err();
416+
#endif
414417

415418
#ifdef HAVE_GAI_STRERROR
416419
v = Py_BuildValue("(is)", error, gai_strerror(error));

Modules/socketmodule.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,18 @@
99
# endif
1010

1111
#else /* MS_WINDOWS */
12+
#if _MSC_VER >= 1300
13+
# include <winsock2.h>
14+
# include <ws2tcpip.h>
15+
# define HAVE_ADDRINFO
16+
# define HAVE_SOCKADDR_STORAGE
17+
# define HAVE_GETADDRINFO
18+
# define HAVE_GETNAMEINFO
19+
# define ENABLE_IPV6
20+
#else
1221
# include <winsock.h>
1322
#endif
23+
#endif
1424

1525
#ifdef HAVE_SYS_UN_H
1626
# include <sys/un.h>

PC/pyconfig.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,11 @@ typedef int pid_t;
408408
/* #undef size_t */
409409

410410
/* Define to `int' if <sys/types.h> doesn't define. */
411+
#if _MSC_VER + 0 >= 1300
412+
/* VC.NET typedefs socklen_t in ws2tcpip.h. */
413+
#else
411414
#define socklen_t int
415+
#endif
412416

413417
/* Define if you have the ANSI C header files. */
414418
#define STDC_HEADERS 1

0 commit comments

Comments
 (0)