Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a python web framework, Tornado, trying to listen on port 8000 but failed.

Under the testing conditions below, firewall has been disabled in system pref pane. ipfw list shows 65535 allow ip from any to any. Ifconfig shows my inet addr = 10.0.1.2

Condition 1:

Start tornado, listens to port 8000 Access localhost:8000 is ok; Access 10.0.1.2:8000 is NOT ok on both local machine and ipad (same Wireless LAN).

Condition 2:

By default the Mountain Lion Apache is on, which is listening to :80 Accesses to localhost:80 and 10.0.1.2:80 are both OK, showing apache It works! page

Condition 3:

sudo apachectl stop, start tornado and make it listen to port 80 Access localhost:80 ok; access 10.0.1.2:80 NOT OK.

What is the reason that only Apache is accessible by other machines, but not my Tornado App, even under the same port? I have searched Serverfault and maybe it is related to launchd, which redirects the port 80 traffic to Apache?

share|improve this question
    
Are there any interesting, related messages in your logs ? –  Iain Oct 12 '13 at 5:17
    
logs are normal for Apache and Tornado (Because no connection so no logs!) What else should I look into? –  MK Yung Oct 12 '13 at 5:37
    
Is Tornado configured to listen on all IPs, or just localhost (127.0.0.1)? Try netstat -an | grep LISTEN to see what ports are listening on which IPs, and look for either "*.80" (all IPs) or "127.0.0.1:80" (just localhost). –  Gordon Davisson Oct 12 '13 at 6:04
    
@GordonDavisson yes! I think I found it! The tornado is listening to tcp4 0 0 127.0.0.1.80 *.* LISTEN tcp6 0 0 fe80::1%lo0.80 *.* LISTEN tcp6 0 0 ::1.80 *.* LISTEN while in contrast to Apache, it is tcp46 0 0 *.80 *.* LISTEN . So how can I start Tornado to listen to "*.80"? Because on linux I could just specify the port and it runs smoothly. –  MK Yung Oct 12 '13 at 6:39
    
Got it now. I found that I added the localhost parameter to the listen() function in Tornado. Thanks all! :D –  MK Yung Oct 12 '13 at 7:04

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.