Search code examples
javasocketsconnectionportportforwarding

Port absolutely refuses to open, despite best efforts


So, I am trying to build a simple java chat application.

The application is supposed to establish a connection on port 5000. When I tried to give the jar to my girlfriend so she could test the client, she gets a connection refused, so I first though to check my ports. Port 5000 absolutely refuses to open.

I have tried everything I can think of (although I am definitely not IT savvy so I could've missed something);

Here are steps I have taken:

  • In command prompt (while the server is running) I have used netstat -an and found port 5000 is listed as listening. When the server is not running, this port is not listed.
  • I have disabled any and all antivirus software /firewalls on my rig, and in my router settings.
  • I have set up a static IP for my rig.
  • I have port forwarded port 5000 on my router and checked and double checked that I have done it correctly.
  • I even contacted my ISP, who swears up and down that they don't block ports.
  • I have tried other ports, not just 5000.

After the above steps, I have used several different sources to check whether port 5000 is open. That thing is more blocked than Michael Moore's arteries.

My question: Why does the internet hate me?

EDIT: over endless hours of chat we (myself and user roelofs) were able to get it working on port 21, (the ftp port), which isn't a problem because there wont be any conflicts, but it isn't right. If anyone can point me in the right direction, I'd much appreciate it. It seems to be some kind of windows specific problem? Maybe? Can confirm ports are correctly forwarded and any kind of security that I can think of is off.


Solution

  • After some testing, it appears that windows might have problems with listening sockets above 1024. Running the code on a port lower than that (and setting up all port forwarding correctly) should get you to the point where you can debug.