why does socket.makefile require non-blocking mode?

Guilherme Polo ggpolo at gmail.com
Sat Mar 29 12:18:23 CET 2008


2008/3/28, Forest <py1.forest at tibit.com>:
> The socket.makefile() docs say, "the socket must be in blocking mode."  I
>  don't see any explanation of why blocking mode is required, and I'm not sure
>  whether that means timeout mode is forbidden as well.  Can someone clarify
>  this?
>

Have you set your socket to be nonblocking ? Otherwise it is blocking,
it is the "normal" one. I don't know why you think timeout is
forbidden too, it is not.

>  I wanted to use file-like objects with socket timeouts, so I ended up writing
>  my own replacement for socket._fileobject.  I'd appreciate it if someone could
>  either explain to my why my new class was unnecessary, or else encourage me to
>  contribute it as a patch to the socket module.
>

It looks like to be unnecessary.

>  Cheers,
>
>  Forest
>
>
>
>
>
>
>
>  --
>  http://mail.python.org/mailman/listinfo/python-list
>


-- 
-- Guilherme H. Polo Goncalves



More information about the Python-list mailing list