[Twisted-Python] Re: Binding echo server to a particular ip address

W.J. miathan at goliath.darktech.org
Wed May 14 11:48:13 MDT 2003


> The following is your simpleserv.py echo server example.  On a multihost
> (multiple ip addresses) server, how would I have it listen on a
> particular ip address?

> def main():
>     """This runs the protocol on port 8000"""
>     factory =3D protocol.ServerFactory()
>     factory.protocol =3D Echo

>     reactor.listenTCP(8000,factory)

reactor.listenTCP(8000, factory, interface="127.0.0.1")

Where 127.0.0.1 is the interface you want to bind to.
Almost too easy uh?

>     reactor.run()

Wladimir






More information about the Twisted-Python mailing list