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$
|