Pair of filenos read/write each other?

Jack Bates tdhfwh at nottheoilrig.com
Thu Aug 15 11:59:29 EDT 2013


On Wed, Aug 14, 2013 at 01:55:38AM +0100, Chris Angelico wrote:
> On Wed, Aug 14, 2013 at 1:17 AM, Rhodri James
> <rhodri at wildebst.demon.co.uk> wrote:
> > On Wed, 14 Aug 2013 00:10:41 +0100, Jack Bates <tdhfwh at nottheoilrig.com>
> > wrote:
> >
> >> Can anyone suggest a way to get a pair of file descriptor numbers such
> >> that data written to one can be read from the other and vice versa?
> >>
> >> Is there anything like os.pipe() where you can read/write both ends?
> >
> >
> > Sockets?  It depends a bit on what you're trying to do, exactly.  If you
> > give us a bit more context, we might be able to give you better advice.
> 
> Specific questions:
> 
> 1) Do you need different processes to do the reading/writing?

No, only one process is involved.

> 2) Do you need to separate individual writes (message mode)?

No, data can be split into smaller writes or merged into a bigger write, so
long as it arrives in order.

> ChrisA

Thank you for your help!



More information about the Python-list mailing list