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"