[Twisted-Python] UDP servers and socket queues

Phil Mayers p.mayers at imperial.ac.uk
Mon Apr 21 14:29:56 EDT 2003


On Mon, Apr 21, 2003 at 11:16:06AM -0400, Itamar Shtull-Trauring wrote:
> 
> I'll take a look at trying to fix this sometime this week. The solution
> will be to do up to X reads of UDP packets in each iteration of the
> event loop, instead of reading only one packet in each iteration. 
> 

I figured something like that. Does anyone know if the various socket
readiness abstractions (select(), poll(), kqueue, RT signals, etc.)
given you sufficient information to know when you can do multiple reads?

The other option I guess would be to for connection-less sockets to do:

while 1:
    try:
        data, addr = self.socket.recvfrom(65535)
        self.protocol.datagramReceived(data, addr)
    except socket.error, se:
        if se.args[0]==errno.EWOULDBLOCK:
            break
    except:
        log.deferr()

...in doRead (line 91, twisted/internet/udp.py)?

-- 

Regards,
Phil

+------------------------------------------+
| Phil Mayers                              |
| Network & Infrastructure Group           |
| Information & Communication Technologies |
| Imperial College                         |
+------------------------------------------+




More information about the Twisted-Python mailing list