Pair of filenos read/write each other?

Nobody nobody at nowhere.com
Wed Aug 14 03:21:36 EDT 2013


On Tue, 13 Aug 2013 16:10:41 -0700, Jack Bates wrote:

> Is there anything like os.pipe() where you can read/write both ends?

There's socket.socketpair(), but it's only available on Unix.

Windows doesn't have AF_UNIX sockets, and anonymous pipes (like the ones
created by os.pipe()) aren't bidirectional. Named pipes are bidirectional,
but you would need to choose a name, create one, connect, and accept (like
with sockets); there's no convenience function like socketpair(). Also,
you need to consider the security implications, as other processes can
(try to) connect to a named pipe.




More information about the Python-list mailing list