[Twisted-Python] PB over unix socket ... how?

twisted gurus ... help! I want to use PB down in the guts of my application, but only later on will I actually be using the pb protocol over the network, so in the meantime I'd like to play it safe and have PB talk to other components over unix domain sockets. I know from wandering around in the internet module that there's lots of support for unix sockets and even an IReactorUNIX, but it's late and I'm a little dizzy and I figured someone could probably point me in the right direction with about 5 lines anyway ... if there's an example, I musta missed it ... 8^P TIA! -- Steve. Stephen C. Waterbury http://misspiggy.gsfc.nasa.gov/people/waterbug.html

On Sat, Aug 10, 2002 at 02:23:01AM -0400, Steve Waterbury wrote:
twisted gurus ... help!
I want to use PB down in the guts of my application, but only later on will I actually be using the pb protocol over the network, so in the meantime I'd like to play it safe and have PB talk to other components over unix domain sockets.
I know from wandering around in the internet module that there's lots of support for unix sockets and even an IReactorUNIX, but it's late and I'm a little dizzy and I figured someone could probably point me in the right direction with about 5 lines anyway ... if there's an example, I musta missed it ... 8^P
Just take the pb examples and change the "listenTCP" call and change the port argument to a string. The string will be the name of unix socket in the filesystem. Change your connectTCP calls similarly and you should be in business. Jp -- A sad spectacle. If they be inhabited, what a scope for misery and folly. If they be not inhabited, what a waste of space. -- Thomas Carlyle, looking at the stars -- 12:28pm up 82 days, 13:16, 6 users, load average: 0.01, 0.02, 0.00

Jp Calderone wrote:
I know from wandering around in the internet module that there's lots of support for unix sockets and even an IReactorUNIX, but it's late and I'm a little dizzy and I figured someone could probably point me in the right direction with about 5 lines anyway ... if there's an example, I musta missed it ... 8^P
Just take the pb examples and change the "listenTCP" call and change the port argument to a string. The string will be the name of unix socket in the filesystem. Change your connectTCP calls similarly and you should be in business.
Uh, no. This only worked because of a bad design decision in tcp.py - it will not work in CVS or in any future release. The real solution then is to fix the pb connection APIs so they use pluggable transports. Glyph tends to do this using URLs, e.g. "pb-tcp://localhost:7777/bar" or "pb-unix://tmp/.socket" or "pb-tls://localhost:8888/baz". There should hopefully be some solution in CVS soon, given that we need this functionality to run twistedmatrix.com.
participants (3)
-
Itamar Shtull-Trauring
-
Jp Calderone
-
Steve Waterbury