[Twisted-Python] how to only accept local computer requests?

Christopher Armstrong radix at twistedmatrix.com
Tue May 9 09:07:16 MDT 2006


On 5/9/06, Michael Li <mli at deform.com> wrote:
> Hi,
>
> I have a python server with twisted framework running
> 24x7. I want to have a config file to setup accepting local
> computer requests or remote computer requests.
> If the config file exists, it only accepts local computer
> request, does not accept requests from other computers.
> If the config file does not exist, it accepts requests
> from any computers.
> Is there any easy way to do it ?

It's not totally clear from what info you've given, but it sounds like
you want to pass the 'interface' argument to TCPServer or listenTCP,
whichever you're using. interface='127.0.0.1' to only serve
connections from localhost, interface='' to serve connections from
anybody.

--
Christopher Armstrong
International Man of Twistery
http://radix.twistedmatrix.com/
http://twistedmatrix.com/
http://canonical.com/




More information about the Twisted-Python mailing list