Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.018 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'advice.': 0.09; 'app,': 0.09; 'wrapper': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'suggest': 0.14; 'descriptor': 0.16; 'do,': 0.16; 'thanks,': 0.17; 'wrote:': 0.18; 'library': 0.18; 'wed,': 0.18; 'bit': 0.19; 'app': 0.19; 'trying': 0.19; 'normally': 0.19; 'written': 0.21; 'aug': 0.22; 'cc:addr:python.org': 0.22; 'header:User-Agent:1': 0.23; 'passes': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'subject:/': 0.26; 'header:In-Reply-To:1': 0.27; 'received:24': 0.27; '+0100,': 0.31; 'app.': 0.31; 'context,': 0.31; 'subject:other': 0.31; 'anyone': 0.31; 'file': 0.32; 'run': 0.32; 'test': 0.35; 'there': 0.35; '14,': 0.36; 'vice': 0.36; 'charset:us-ascii': 0.36; 'subject:?': 0.36; 'depends': 0.38; 'anything': 0.39; 'read': 0.60; 'numbers': 0.61; "you're": 0.61; 'content-disposition:inline': 0.62; 'such': 0.63; 'more': 0.64; 'mock': 0.84; 'subject:read': 0.84; 'subject:Pair': 0.91; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=nottheoilrig.com; s=mail; t=1376582170; bh=HzP0AU3Qwz8JfTx+DNjp/h9krdTz9JwLq9YOMCz5sLM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:In-Reply-To; b=eD7PAGSXpBd1yED2MSumCoaOwGCMTmo9mw1bc4pV9Dz8xcyyt3JSb9bbUwxRJ2iK1 0ornuRaJLcEIlKmY8iiG3xHYt7t0MwnWp0jDdtma4MY1J0Iq2L2t5fUpKD4r2+3+W0 gn5Ca0Bsg+59swk8bRDf5DHyAM+tglZ6Fl+3bhsM= Date: Thu, 15 Aug 2013 08:56:10 -0700 From: Jack Bates To: Rhodri James Subject: Re: Pair of filenos read/write each other? References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 20 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1376582179 news.xs4all.nl 15926 [2001:888:2000:d::a6]:39177 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:52555 On Wed, Aug 14, 2013 at 01:17:40AM +0100, Rhodri James wrote: > On Wed, 14 Aug 2013 00:10:41 +0100, Jack Bates > 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. Thanks, I am writing a fixture to test an app. The app normally uses the Python wrapper for the GnuTLS library to handshake with a service that I want to mock up in my fixture. The app passes a file descriptor number to gnutls_transport_set_ptr() When I test the app, the app and fixture run in the same process. I want a file descriptor number I can foist on the app, and in the fixture access what is read/written to it by the GnuTLS wrapper.