[Twisted-Python] What the hell?
![](https://secure.gravatar.com/avatar/433365de0f787faa3ed3e6dd1da5884f.jpg?s=120&d=mm&r=g)
From tcp.py: ============ class Client(Connection): """A client for TCP (and similiar) sockets. """ def __init__(self, host, port, protocol): """Initialize the client, setting up its socket, and request to connect. """ if host == 'unix': # "port" in this case is really a filename ... ============ That is sooo wrong. What if my computer is named 'unix'? Why does the TCP code deal with files?
![](https://secure.gravatar.com/avatar/e1793b3d2f06563cd1b47c5a19598b04.jpg?s=120&d=mm&r=g)
From: Itamar <twisted@itamarst.org> Subject: [Twisted-Python] What the hell? Date: Fri, 31 Aug 2001 13:15:16 -0400
if you're adding xfstt to your fontpath, the url to use is unix:7101/ xfs is at unix:7100/ so I'd assume is specific to some kind of IPC. Therefore, I bet yer system will act strangely if you make your hostname 'unix' ---- Shae Matijs Erisson - http://www.webwitches.com/~shae/ bRing mE fIve sQuirrels aNd nO oNe wIll gEt hUrt 13:00pm up 1 season, 1 squirrel, load average: 1+1j 0.5+2j 0.2+0.5j
![](https://secure.gravatar.com/avatar/e1554622707bedd9202884900430b838.jpg?s=120&d=mm&r=g)
Right, but only part of the explanation :-). This has previously been discussed a little, and my initial this answer is here: http://twistedmatrix.com/pipermail/twisted-python/2001-July/000139.html On Fri, Aug 31, 2001 at 08:40:03PM +0300, Shae Erisson wrote:
-- ______ __ __ _____ _ _ | ____ | \_/ |_____] |_____| |_____| |_____ | | | | @ t w i s t e d m a t r i x . c o m http://twistedmatrix.com/users/glyph
![](https://secure.gravatar.com/avatar/6935bc18f0dac3c422ac0135eaf91f2e.jpg?s=120&d=mm&r=g)
I agree. The transport for a client or server should probally not be generalized to a socket at all. Maybe this call for the creation of twisted.transport ? I am not familiar much with the twisted codebase, so excuse me if something like this already exists :) On Fri, Aug 31, 2001 at 01:15:16PM -0400, Itamar wrote:
-- python -c "print reduce(lambda x,y: x+y,map(lambda x: chr((23069453891\ 36636418523668102630431981680355427L>>(x*8))&0xFF),xrange(0,19)))"
![](https://secure.gravatar.com/avatar/6935bc18f0dac3c422ac0135eaf91f2e.jpg?s=120&d=mm&r=g)
I agree. The transport for a client or server should probally not be generalized to a socket at all. Maybe this calls for the creation of twisted.transport ? I am not familiar much with the twisted codebase, so please dont flame me if something like this already exists :) On Fri, Aug 31, 2001 at 01:15:16PM -0400, Itamar wrote:
-- python -c "print reduce(lambda x,y: x+y,map(lambda x: chr((23069453891\ 36636418523668102630431981680355427L>>(x*8))&0xFF),xrange(0,19)))"
![](https://secure.gravatar.com/avatar/6935bc18f0dac3c422ac0135eaf91f2e.jpg?s=120&d=mm&r=g)
I agree. The transport for a client or server should probally not be generalized to a socket at all. Maybe this calls for the creation of twisted.transport ? I am not familiar much with the twisted codebase, so don't kill me if something like this already exists :) On Fri, Aug 31, 2001 at 01:15:16PM -0400, Itamar wrote:
-- python -c "print reduce(lambda x,y: x+y,map(lambda x: chr((23069453891\ 36636418523668102630431981680355427L>>(x*8))&0xFF),xrange(0,19)))"
![](https://secure.gravatar.com/avatar/6935bc18f0dac3c422ac0135eaf91f2e.jpg?s=120&d=mm&r=g)
OOPS! I just switched ISPs and was figuring out my mail relay and the message got sent three times! /me curses exim. On Fri, Aug 31, 2001 at 11:51:45AM -0700, Chris Clearwater wrote:
-- python -c "print reduce(lambda x,y: x+y,map(lambda x: chr((23069453891\ 36636418523668102630431981680355427L>>(x*8))&0xFF),xrange(0,19)))"
![](https://secure.gravatar.com/avatar/3477a9de290ec6d77129af504faa1c0b.jpg?s=120&d=mm&r=g)
On Fri, 31 Aug 2001, Chris Clearwater <chris@detriment.org> wrote:
I'd like (at least) Port to be able to take a bound socket, instead of binding it itself. Then have a couple of convinience routines def InetPort(factory, port, interface='', backlog=5): sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.bind( (interface, port) ) sock.listen(backlog) return Port(factory, socket, 'INET') def UnixPort(factory, port, interface='', backlog=5): ... return Port(factory, socket, 'UNIX') The third argument is passed to the Server class, which puts it in .getPeer() -- The Official Moshe Zadka FAQ: http://moshez.geek The Official Moshe Zadka FAQ For Dummies: http://moshez.org Read the FAQ
![](https://secure.gravatar.com/avatar/e1554622707bedd9202884900430b838.jpg?s=120&d=mm&r=g)
On Sun, Sep 02, 2001 at 01:05:08AM +0300, Moshe Zadka wrote:
That would make the Port instance impossible to persist, and adds no value, unless there's some particular external API we need to interact with that speaks in terms of sockets... -- ______ __ __ _____ _ _ | ____ | \_/ |_____] |_____| |_____| |_____ | | | | @ t w i s t e d m a t r i x . c o m http://twistedmatrix.com/users/glyph
![](https://secure.gravatar.com/avatar/3477a9de290ec6d77129af504faa1c0b.jpg?s=120&d=mm&r=g)
On Sat, 1 Sep 2001, Glyph Lefkowitz <glyph@twistedmatrix.com> wrote:
That would make the Port instance impossible to persist
Good point
This would make it possible to bind() as root in a seperate C program and then to drop privs and execute Twisted. Also, that would help if you get the socket from another process over a UNIX domain socket. -- The Official Moshe Zadka FAQ: http://moshez.geek The Official Moshe Zadka FAQ For Dummies: http://moshez.org Read the FAQ
![](https://secure.gravatar.com/avatar/e1554622707bedd9202884900430b838.jpg?s=120&d=mm&r=g)
On Sun, Sep 02, 2001 at 08:02:12PM +0300, Moshe Zadka wrote:
OK. First time we see one of these as an actual requirement, let's do it. 'Til then I think it's best to put it off. -- ______ __ __ _____ _ _ | ____ | \_/ |_____] |_____| |_____| |_____ | | | | @ t w i s t e d m a t r i x . c o m http://twistedmatrix.com/users/glyph
![](https://secure.gravatar.com/avatar/e1793b3d2f06563cd1b47c5a19598b04.jpg?s=120&d=mm&r=g)
From: Itamar <twisted@itamarst.org> Subject: [Twisted-Python] What the hell? Date: Fri, 31 Aug 2001 13:15:16 -0400
if you're adding xfstt to your fontpath, the url to use is unix:7101/ xfs is at unix:7100/ so I'd assume is specific to some kind of IPC. Therefore, I bet yer system will act strangely if you make your hostname 'unix' ---- Shae Matijs Erisson - http://www.webwitches.com/~shae/ bRing mE fIve sQuirrels aNd nO oNe wIll gEt hUrt 13:00pm up 1 season, 1 squirrel, load average: 1+1j 0.5+2j 0.2+0.5j
![](https://secure.gravatar.com/avatar/e1554622707bedd9202884900430b838.jpg?s=120&d=mm&r=g)
Right, but only part of the explanation :-). This has previously been discussed a little, and my initial this answer is here: http://twistedmatrix.com/pipermail/twisted-python/2001-July/000139.html On Fri, Aug 31, 2001 at 08:40:03PM +0300, Shae Erisson wrote:
-- ______ __ __ _____ _ _ | ____ | \_/ |_____] |_____| |_____| |_____ | | | | @ t w i s t e d m a t r i x . c o m http://twistedmatrix.com/users/glyph
![](https://secure.gravatar.com/avatar/6935bc18f0dac3c422ac0135eaf91f2e.jpg?s=120&d=mm&r=g)
I agree. The transport for a client or server should probally not be generalized to a socket at all. Maybe this call for the creation of twisted.transport ? I am not familiar much with the twisted codebase, so excuse me if something like this already exists :) On Fri, Aug 31, 2001 at 01:15:16PM -0400, Itamar wrote:
-- python -c "print reduce(lambda x,y: x+y,map(lambda x: chr((23069453891\ 36636418523668102630431981680355427L>>(x*8))&0xFF),xrange(0,19)))"
![](https://secure.gravatar.com/avatar/6935bc18f0dac3c422ac0135eaf91f2e.jpg?s=120&d=mm&r=g)
I agree. The transport for a client or server should probally not be generalized to a socket at all. Maybe this calls for the creation of twisted.transport ? I am not familiar much with the twisted codebase, so please dont flame me if something like this already exists :) On Fri, Aug 31, 2001 at 01:15:16PM -0400, Itamar wrote:
-- python -c "print reduce(lambda x,y: x+y,map(lambda x: chr((23069453891\ 36636418523668102630431981680355427L>>(x*8))&0xFF),xrange(0,19)))"
![](https://secure.gravatar.com/avatar/6935bc18f0dac3c422ac0135eaf91f2e.jpg?s=120&d=mm&r=g)
I agree. The transport for a client or server should probally not be generalized to a socket at all. Maybe this calls for the creation of twisted.transport ? I am not familiar much with the twisted codebase, so don't kill me if something like this already exists :) On Fri, Aug 31, 2001 at 01:15:16PM -0400, Itamar wrote:
-- python -c "print reduce(lambda x,y: x+y,map(lambda x: chr((23069453891\ 36636418523668102630431981680355427L>>(x*8))&0xFF),xrange(0,19)))"
![](https://secure.gravatar.com/avatar/6935bc18f0dac3c422ac0135eaf91f2e.jpg?s=120&d=mm&r=g)
OOPS! I just switched ISPs and was figuring out my mail relay and the message got sent three times! /me curses exim. On Fri, Aug 31, 2001 at 11:51:45AM -0700, Chris Clearwater wrote:
-- python -c "print reduce(lambda x,y: x+y,map(lambda x: chr((23069453891\ 36636418523668102630431981680355427L>>(x*8))&0xFF),xrange(0,19)))"
![](https://secure.gravatar.com/avatar/3477a9de290ec6d77129af504faa1c0b.jpg?s=120&d=mm&r=g)
On Fri, 31 Aug 2001, Chris Clearwater <chris@detriment.org> wrote:
I'd like (at least) Port to be able to take a bound socket, instead of binding it itself. Then have a couple of convinience routines def InetPort(factory, port, interface='', backlog=5): sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.bind( (interface, port) ) sock.listen(backlog) return Port(factory, socket, 'INET') def UnixPort(factory, port, interface='', backlog=5): ... return Port(factory, socket, 'UNIX') The third argument is passed to the Server class, which puts it in .getPeer() -- The Official Moshe Zadka FAQ: http://moshez.geek The Official Moshe Zadka FAQ For Dummies: http://moshez.org Read the FAQ
![](https://secure.gravatar.com/avatar/e1554622707bedd9202884900430b838.jpg?s=120&d=mm&r=g)
On Sun, Sep 02, 2001 at 01:05:08AM +0300, Moshe Zadka wrote:
That would make the Port instance impossible to persist, and adds no value, unless there's some particular external API we need to interact with that speaks in terms of sockets... -- ______ __ __ _____ _ _ | ____ | \_/ |_____] |_____| |_____| |_____ | | | | @ t w i s t e d m a t r i x . c o m http://twistedmatrix.com/users/glyph
![](https://secure.gravatar.com/avatar/3477a9de290ec6d77129af504faa1c0b.jpg?s=120&d=mm&r=g)
On Sat, 1 Sep 2001, Glyph Lefkowitz <glyph@twistedmatrix.com> wrote:
That would make the Port instance impossible to persist
Good point
This would make it possible to bind() as root in a seperate C program and then to drop privs and execute Twisted. Also, that would help if you get the socket from another process over a UNIX domain socket. -- The Official Moshe Zadka FAQ: http://moshez.geek The Official Moshe Zadka FAQ For Dummies: http://moshez.org Read the FAQ
![](https://secure.gravatar.com/avatar/e1554622707bedd9202884900430b838.jpg?s=120&d=mm&r=g)
On Sun, Sep 02, 2001 at 08:02:12PM +0300, Moshe Zadka wrote:
OK. First time we see one of these as an actual requirement, let's do it. 'Til then I think it's best to put it off. -- ______ __ __ _____ _ _ | ____ | \_/ |_____] |_____| |_____| |_____ | | | | @ t w i s t e d m a t r i x . c o m http://twistedmatrix.com/users/glyph
participants (6)
-
Chris Clearwater
-
Glyph Lefkowitz
-
Itamar
-
j.her@t-online.de
-
Moshe Zadka
-
Shae Erisson