It isn't clear what experience you have with networking, so apologies if this is stuff you already know. I'm not aware of a single magic tool, but take a look at the following tools:
- telnet (you'll need any TCP based server running on the destination machine)
- wget (if you have a HTTP server on the destination machine)
Some will be installed already on almost any system. This should give you some sense of where in the network stack the problem lies. For the server side, you might want to use tools like netstat or ipconfig/ifconfig to understand what is going on.
It isn't clear whether you are talking about connecting to your PC, or making connections from your PC. Assuming you are talking about trying to host a server on a typical home internet connection, some things to check for include:
- Your ISP is blocking traffic on an unusual port
- The outbound router has its own firewall, and that is configured to reject any inbound connections
- The outbound router is a NAT, and is not configured to forward connections
- The outbound router is a NAT, but doesn't support connecting to "itself" (i.e. accessing http://my-public-address from "inside" the router doesn't work)
- The outbound router is configured to go to "sleep" (i.e. release the WAN IP address) after a certain amount of inactivity
- Your computer is not listening on the relevant IP address (e.g. it might only be listening on the local one)
- Your computer is not listening on the relevant port
A good thing to try first is an existing popular HTTP server on port 80 - this allows you to test from any browser, some websites will allow you to hit a HTTP URL from outside your network, and you know the problem is not something specific to your program.
Personally, the big hurdle when I tried to do this before was my router. It took quite some time before I tracked down all the settings which interfered with a reliable inbound connection - the "sleep" option was the hardest to figure out, it used to work fine while at home, but when I was away later and tried, it sometimes wouldn't work! I'd recommend going through all of the advanced screens in your router configuration, not just the obvious ones.
Edited by rip-off, 31 March 2014 - 04:13 PM.