[Twisted-Python] What the hell?

Moshe Zadka m at moshez.org
Sat Sep 1 18:05:08 EDT 2001

On Fri, 31 Aug 2001, Chris Clearwater <chris at detriment.org> wrote:

> 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 :)

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) )
    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

More information about the Twisted-Python mailing list