Issue with select.select() and missing data

nnp version5 at gmail.com
Sun Mar 23 22:26:32 CET 2008


Hi guys,

I have an issue when using select.select(). I have an application that
creates sockets then sends data on them. These sockets are then passed off
to a listener which uses select.select() to detect any responses. For some
reason every socket can only receive one response before my computer begins
to issue ICMP port unreachable messages for that port. The code doing the
listening is below. No sockets are returned in the broken list. Can anyone
spot anything stupid I'm doing in the following code or think of any reason
for this issue?

    def __listen(self):

        while self.listening and len(self.notify_q_list) != 0:
            self.lock.acquire()

            r_read, r_write, broken = select(self.socket_list, [], [], .1)
            for sock in r_read:
                data, addr = sock.recvfrom(2**16)

                for function_tuple in self.notify_q_list:
                    function_tuple[0].put((True, data, 1, addr, 5.0))

            self.lock.release()
            time.sleep(.1)

        for sock in self.socket_list:
            sock.close()

        self.socket_list = []

Thanks,
nnp

-- 
http://www.smashthestack.org
http://www.unprotectedhex.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080323/fee1c387/attachment.html>


More information about the Python-list mailing list