asyncore and OOB data
billiejoex
gnewsg at gmail.com
Wed Jul 11 12:54:27 EDT 2007
Hi there,
In an asyncore based FTP server I wrote I should be able to receive
OOB data from clients.
A client sending such kind of data should act like this:
>>> import socket
>>> s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
>>> s.connect(('127.0.0.1', 21))
>>> s.sendall('hello there\r\n', socket.MSG_OOB)
According to asyncore documentation I should handle this kind of event
in "handle_expt" method of dispatcher class, that should be called
when OOB is received by the underlying socket. I've tried to override
handle_expt method in such way:
def handle_expt(self):
print "OOB data arrived"
data = self.socket.recv(1024, socket.MSG_OOB)
print data
...but, even if it is called, "data" contains only a "\n" character
instead of the entire string ("hello there\r\n").
Why does this happen? Should I have to use a different approach?
Thanks in advance.
More information about the Python-list
mailing list