python server port forwarding problem

Reply

Join Date: Feb 2009
Posts: 1
Reputation: Alien15x is an unknown quantity at this point 
Solved Threads: 0
Alien15x Alien15x is offline Offline
Newbie Poster

python server port forwarding problem

 
0
  #1
Feb 10th, 2009
am i correct in assuming that when a computer behind a router with port forwarding opens a port (port 1337, when i run my server), that the router automatically notices and sets itself up to send all port 1337 traffic to that computer?

i've got two simple applications, a client and a server. Bound to 127.0.0.1, the client finds the server just fine, but bind the server to the local network address (172.16.0.2) and aim the outgoing connection at the router (public) ip (from whatismyip.com), and the router denies the connection.
i suspect i just need to somehow tell the router that my computer is using port 1337, and that it should forward incoming traffic instead of denying it... or of course i could be hopelessly wrong. anyone, ideas?

#server
import socket
myip = socket.gethostbyname(socket.gethostname())
port = 1337
sock = socket.socket()
sock.bind((myip, port))
sock.listen(5)
print sock.accept()[1]

and

#client
import socket
server = "71.62.9.147"
port = 5132
sock = socket.socket()
sock.connect((server, port))
print "connected"
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 48
Reputation: yilmazhuseyin is an unknown quantity at this point 
Solved Threads: 5
yilmazhuseyin's Avatar
yilmazhuseyin yilmazhuseyin is offline Offline
Light Poster

Re: python server port forwarding problem

 
0
  #2
Feb 10th, 2009
1) check firewall in your computer. this is not likely the case. but if you have a firewall set you have to open the port from your firewall too.
2) your router might not working correctly. That actualy happened to me. some routers have the port forwarding in their menu but it does not work. (if you are in the US. that is probably not the case.)
3) restart your router (don't ask )

if I were you I would try to forward some other port that you are sure , some app is listening to. for example I got ssh daemon listening to port 23 so I would try to forward port 23 and try connect to my computer with an ssh client. If I can connect to it , that means my network is fine.

I can not tell you what is wrong with your network but, those are the ways that I would follow to diagnose it. I hope that helps.
Reply With Quote Quick reply to this message  
Join Date: Apr 2008
Posts: 670
Reputation: Freaky_Chris is a jewel in the rough Freaky_Chris is a jewel in the rough Freaky_Chris is a jewel in the rough 
Solved Threads: 113
Freaky_Chris's Avatar
Freaky_Chris Freaky_Chris is offline Offline
Practically a Master Poster

Re: python server port forwarding problem

 
0
  #3
Feb 11th, 2009
You may find your router has a 'virtual server' set up of some kind, if it has then it will allow you to add incoming requests to the list. This will give you the option to have you router watch the information coming on a sepecfic port then forward that request to the internal IP address and port you specify on any computer.

This is how I had my Python server set up, and it worked perfectly. Just remeber accessing the server internally and externally IS different, so test it from an external location.

Chris
Knowledge is power -- But experience is everything
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Python Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC