views:

214

answers:

2

I am trying to get a simple TCP server running on my server. I am using echoserv.py and echoclient.py on the Twisted examples page. When I run echoserv.py on the server, I can connect fine using the following in echoclient.py:

reactor.connectTCP('localhost', 8000, factory) <- for a localhost connection
reactor.connectTCP('192.168.0.250', 8000, factory) <- for a lan connection

but when I try to connect remotely via the Internet, I use the following line in echoclient.py:

reactor.connectTCP('mydomain.com', 8000, factory)

However when I try to run echoclient.py, there is a pause, and then I get:

connection failed: User timeout caused connection failure.

I know it is doing something with my domain, because when I do a random domain, I get:

connection failed: Connection was refused by other side: 111: Connection refused.

All my ports are configured correctly for port 8000, and I'm sure it's not my ISP blocking the ports (I can use random ports all the time with other applications). I've also tried using ports besides 8000, but no avail. Here is the port fowarding line in my router page if it helps:

[X] tcp_server            192.168.0.250 TCP 8000/8000    always   edit delete

Any idea why this is happening?

+1  A: 

When you program your router to port-forward outcoming connections to your inbound server, it actually works only if the clients (those who try to connect) are really outside your network, really coming from the cloud. You, from inside your network, can't use it, it won't work for you. You will have the feeling that it is not working, but it is. At least for those outside.

Search for Port Forwarding Tester at Google to take a proof of that. This one (first result of Google) is working pretty fine: http://www.yougetsignal.com/tools/open-ports/

Havenard
+1  A: 

Have you tried the following?

  1. Do a port scan on the IP of the machine running the server to confirm that the port is open. A simple [google search][1] will give you plenty of options.
  2. If the port is shown to be open, try the remote connection via telnet instead of the twisted client script. Some system firewalls block the application level (such as Windows XP) and could be blocking your outgoing connection without you realizing it.
Mark Roddy
Thanks for suggesting the port forwarding checkers. Apparently port 8000 appears to be blocked whether my TCP server is running or not. I don't understand this since I have port 8000 enabled on my router. Any idea why it's blocked? Maybe it is my ISP...
Cory Walker