On Friday 14 August 2009 09:15:34 Gabriel Rossetti wrote:
> Hello everyone,
>
> I get a (11, 'Resource temporarily unavailable') error when I try to
> send a file using a socket. Is there s size limit? I tried sending a
> smaller file and ii poses no problem. Am I doing something wrong? Here
> is the code:
>
> def sendMessage(host, port, msg):
>
> if isinstance(msg, unicode):
> msg = msg.encode("utf-8")
>
> sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
> sock.connect((host, port))
> sock.setblocking(0)
This is the problem - if the socket does not block, it will return
the " temporarily unavailable" error when it is busy.
If you want to use it non blocking then you have to handle the
error in a try except, and loop.
- Hendrik
--
http://mail.python.org/mailman/listinfo/python-list