[Twisted-Python] Perspective broker and pipes

Nitro nitro at dr-code.org
Wed Oct 31 09:24:50 EDT 2007


Am 31.10.2007, 12:59 Uhr, schrieb Jean-Paul Calderone <exarkun at divmod.com>:

> On Wed, 31 Oct 2007 08:41:10 +0100, Nitro <nitro at dr-code.org> wrote:
>> Hello,
>>
>> I wrote a pb application which also uses udp sockets. It works nicely.  
>> Now
>> there's the situation where client and server are both located on the  
>> same
>> machine. This means I could just connect to localhost and everything
>> works. Unfortunately some firewalls warn about connections. I want to
>> avoid this.
>> So I thought about replacing the transports in pb with pipes instead of
>> sockets if the server and client are both on the same machine. I'd have  
>> to
>> do the same for my custom udp solution. Doing it for my custom udp code  
>> is
>> easy, but how do I do this with pb?
>> Do I just have to create some kind of reactor.createPipe() thing or is
>> there more to it?
>
> Since you're concerned about firewalls warning about connections, I'm
> guessing you're thinking about Windows.  In that case, you can't use
> IReactorUNIX and IReactorUNIXDatagram, which would perhaps meet your
> use case (although for all I know, some firewall software warns about
> UNIX connections).

Yes, I am mainly working on windows.

> There is no support for communicating over arbitrary pipes in Twisted.
> There is incidental support for communicating with pipes connected to
> another process created with reactor.spawnProcess, but the process API
> is not the same as the IProtocol API.
>
> In general, using pipes will lessen performance anyway.

How big is the actual performance impact? The throughput right now is  
~10-50 kbyte/s. Is there a better way than pipes? They were just the first  
thing that came to my mind.
If pipes are still ok for my situation, how would I continue? Implement  
some kind of PipeCommunication class which implements IProtocol? What's  
the next step then? How do I plug this into pb?

Thanks for your time.

-Matthias




More information about the Twisted-Python mailing list