newbie - winsock error 10054 - connection reset by peer
Thom Wysong
tgw at email.msn.com
Tue Feb 20 09:31:18 EST 2001
I'm attempting to run a simple "Fetch Data via HTTP" example on p.283 of the
book "Python Programming on Win32". It is ending in a "10054, winsock
error". I don't know what's causing this or how to fix it. I'm hoping
someone can help.
I'm running Win98 on a Gateway laptop, connected to the Internet with MSN.
First, I typed in the following, which went fine...
-------------------------
Python 1.5.2 (#0, Apr 13 1999, 10:51:12) [MSC 32 bit (Intel)] on win32
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>>
>>> import httplib
>>> http=httplib.HTTP('www.python.org')
>>>
>>> http.putrequest('GET', '/index.html')
>>> http.putrequest('Accept', 'text/html')
>>> http.putrequest('Accept', 'text/plain')
>>> http.endheaders()
>>>
-------------------------
Next, the screen is supposed to look like this....
-------------------------
>>> errcode, errmsg, headers = http.getreply()
>>> print errcode, errmsg, headers
200 OK <mimetools.Message instance at 1073680>
>>>
-------------------------
However, what actually happens is this...
-------------------------
>>> errcode, errmsg, headers = http.getreply()
Traceback (innermost last):
File "<pyshell#9>", line 1, in ?
errcode, errmsg, headers = http.getreply()
File "C:\Program Files\Python\Lib\httplib.py", line 121, in getreply
line = self.file.readline()
File "C:\Program Files\Python\Lib\plat-win\socket.py", line 117, in
readline
new = self._sock.recv(self._rbufsize)
error: (10054, 'winsock error')
>>>
-------------------------
The winsock error 10054 shows up for no apparent reason. The page at
http://support.microsoft.com/support/kb/articles/Q150/5/37.asp states that
winsock error 10054 means "Connection reset by peer".
Does anyone have any idea what causes this or how to fix it?
Thanks,
tgw
More information about the Python-list
mailing list