Issue908631
This issue tracker has been migrated to GitHub,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Unsupported provider
Created on 2004-03-02 23:16 by jeffconnelly, last changed 2022-04-11 14:56 by admin. This issue is now closed.
Files | ||||
---|---|---|---|---|
File name | Uploaded | Description | Edit | |
py-winsock-patches.tar | jeffconnelly, 2004-03-02 23:16 | Use WinSock2 on Win32 Python |
Messages (6) | |||
---|---|---|---|
msg45440 - (view) | Author: Jeff Connelly aka shellreef (jeffconnelly) | Date: 2004-03-02 23:16 | |
WinSock 2 isn't supported on 2.3. The capability is there, but the Microsoft C++ version is incorrectly specified to the preprocessor, VC++ 6 (the version used to build the official Python Win32 executable) misses the #if's and links to wsock32.lib, instead. This results in the programmer only being able to use WinSock 1, instead of WinSock 2's useful functions. On modern Win32's, WinSock 2 is prevalent, so the switch shouldn't cause too much trouble, as well as providing additional functionality. The problem appears to be line 16 of socketmodule.h, which includes WinSock 2 #if _MSC_VER >= 1300 and WinSock 1 otherwise. (IP_HDRINCL is a part of WinSock 2.) Apply this patch to use WinSock 2 on MS VC++ 6 (1200), which is what the Python Win32 builds are compiled with. (1300 is .Net? maybe?) pyconfig.h also needs to be patched. Also, the _socket moduleneeds to link with ws2_32.lib instead of wsock32.lib. (Project -> Settings -> highlight _socket -> Win32 release -> Link tab -> in "Object/library modules" change wsock32.lib to ws2_32.lib). With these changes, IP_HDRINCL exists in socket: C:\>python Python 2.3.3 (#51, Dec 18 2003, 20:22:39) [MSC v.1200 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import socket >>> socket.IP_HDRINCL 2 >>> And it works as it should, as do other obscure WinSock 2 functions. |
|||
msg45441 - (view) | Author: Jeff Connelly aka shellreef (jeffconnelly) | Date: 2004-03-02 23:18 | |
Logged In: YES user_id=31953 P.S.: The original bug report is here: https://sourceforge.net/tracker/index.php? func=detail&aid=860134&group_id=5470&atid=105470 |
|||
msg45442 - (view) | Author: Jeff Connelly aka shellreef (jeffconnelly) | Date: 2004-03-02 23:20 | |
Logged In: YES user_id=31953 P.S.: The original bug report is here: https://sourceforge.net/tracker/index.php? func=detail&aid=860134&group_id=5470&atid=105470 |
|||
msg45443 - (view) | Author: Jeff Connelly aka shellreef (jeffconnelly) | Date: 2004-07-17 10:17 | |
Logged In: YES user_id=31953 Can this change be merged into the current source tree? I need WinSock 2 for my application and distributing a patched version of Python isn't very elegant. |
|||
msg45444 - (view) | Author: Jeff Connelly aka shellreef (jeffconnelly) | Date: 2004-08-25 04:51 | |
Logged In: YES user_id=31953 Python 2.4a2 fixes this issue somewhat, but not completely. Since the Win32 release is compiled using Visual Studio 7.1, the IP_HDRINCL and related symbols are defined. However, socketmodule still links to wsock32.lib instead of ws2_32.lib. This means that setsockopt(IP_HDRINCL) appears to work, and even returns None, but it doesn't really work. From http://www2.2cah.com/ws2/log9706.txt : > You're not doing anything wrong. The problem is that, unfortunately, > Micorosoft's WinSock 2 doesn't support the IP_HDRINCL socket option. > > They don't support IPPROTO_RAW ("raw IP") either. They will gladly > give you a socket, but then they send your IP header as data, and > send a bogus IP datagram that has 255--the value of IPPROTO_RAW-- > as the protocol ID. If you look at the net traffic that results > from this (with a net analyzer), you'd see the receiver of this > bogus datagram respond with a "Protocol Unreachable" ICMP error > message. I haven't even succesfully sent raw sockets with wsock32.lib. This is fixed in ws2_32.lib. So all that Python has to do to pull in these fixes is to link to wsock32.lib instead of ws2_32.lib. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/winsock/wsacleanup_2.asp says: >Client: Requires Windows XP, Windows 2000 Professional, >Windows NT Workstation, Windows Me, Windows 98, or >Windows 95. >[...] >Library: Use Ws2_32.lib. Therefore it leads me to believe that having Python link with ws2_32.lib shouldn't cause any compatibility problems on older systems, provided they have the Winsock2 updates. If anyone is here, can we expect this patch to be merged soon? Thanks, -jc |
|||
msg45445 - (view) | Author: Martin v. Löwis (loewis) * | Date: 2004-09-18 16:18 | |
Logged In: YES user_id=21627 I have changed _socket.vcproj 1.6 to link with ws2_32.lib (and I wonder whether any library needs to be specified in the project in the first place). I'm rejecting this patch as out-of-date - the build procedure for VC6 won't be changed, now that we have VC7. |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-11 14:56:03 | admin | set | github: 39999 |
2004-03-02 23:16:49 | jeffconnelly | create |