Bugs item #1379209, was opened at 2005-12-12 22:14
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1379209&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Roy Smith (roysmith)
Assigned to: Nobody/Anonymous (nobody)
Summary: socket.recv(OOB) raises exception on closed socket
Initial Comment:
frame:pyClient$ python
Python 2.4.1 (#1, Aug 16 2005, 20:11:22)
[GCC 3.4.3] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> ^D
frame:pyClient$ uname -a
SunOS frame 5.8 Generic_108528-27 sun4u sparc
If you try to read out-of-band data on a closed socket, the recv() call
raises socket.error, signaling "invalid argument". This seems wrong.
Doing a normal (in-band) recv() on a closed socket returns an empty
string; trying to read OOB data should do the same thing.
At worst, it should raise a more specific error. I'm guessing this
exception is reflecting an errno of EBADF. A more specific error would
at least make it clear that it's the first argument to recv() which was
bad, not the second.
frame:pyClient$ cat oob.py
#!/usr/bin/env python
import socket
s = socket.socket()
s.connect (("localhost", 13)) # 13 = daytime
print "==> ", `s.recv(1024)`
print "OOB: ", `s.recv (1024, socket.MSG_OOB)`
frame:pyClient$ ./oob.py
==> 'Mon Dec 12 22:00:29 2005\n\r'
OOB:
Traceback (most recent call last):
File "./oob.py", line 8, in ?
print "OOB: ", `s.recv (1024, socket.MSG_OOB)`
socket.error: (22, 'Invalid argument')
frame:pyClient$
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1379209&group_id=5470
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com