[Python-de] Problem mit SocketServer
Alexander Langer
alexander.langer at address.invalid
Mo Mai 6 14:02:06 CEST 2013
Hi Eugen,
ja, normalerweise !
Socket-Objekte blockieren per default. Zitat:
Some notes on socket blocking and timeouts: A socket object can be in
one of three modes: blocking, non-blocking, or timeout. Sockets are
always created in blocking mode. In blocking mode, operations block
until complete or the system returns an error (such as connection timed
out).
http://docs.python.org/2/library/socket.html
SocketServer.recv() blockiert jedoch nicht. Folglich läuft die while
Schleife durch und meine CPU-Last steigt auf 25%.
Dieses non-blocking Verhalten ist auch nicht dokumentiert. Anscheinend
ging der Autor davon aus dass man nur Requests im Stile von HTTP absetzt :/
Ein Single-Thread-Modell reicht mir völlig aus. Nur würde ich gerne
reines Python verwenden.
Mehr Informationen über die Mailingliste python-de