zwierzak
zwierzak

Reputation: 269

Tornado as normal server

How to listen for the connections on Tornado Web Server coming not from local network? Default it listening only for connection from localhost. I have tried tips from Django to start it listening on address 0.0.0.0 but this doesn't work.

Some simple code:

server = tornado.httpserver.HTTPServer(application)
server.listen(8000, '0.0.0.0')

Upvotes: 3

Views: 12125

Answers (2)

Rob Cowie
Rob Cowie

Reputation: 22619

BY default the tornado httpserver will listen on the specified port for all net interfaces (IP addresses). So, passing the port only should work fine.

You also need to be sure to start the ioloop instance that the server is using:

http_server = tornado.httpserver.HTTPServer(application)
http_server.listen(8000)
tornado.ioloop.IOLoop.instance().start()

The tornado docs are very good.

Upvotes: 15

Ben Noland
Ben Noland

Reputation: 34948

I found this question while trying trying to diagnose a similar issue (tornado server running on computer A, inaccessible from computer B).

I eventually figured it out, I needed to open the port on computer A's firewall.

Upvotes: 4

Related Questions