Alright, so I've got my port forwarded, and I've tried it with all firewalls off, and in DMZ mode (All ports open), so It's not a network problem. I've scanned my port with the server running, and the scanner picks up the port, and the server (Thinking it's a player) prints out that a new player has connected.The client can connect to the server on localhost, and 127.0.0.1, but not on any global IP. I've tried this on multiple networks (Giving friends the server, and client) but to no avail.

So I'm going to post some connection code up, and maybe one of you can tell me whats wrong? Also I'll post up the client/server pack, in hopes that one of you can get it working, somehow.

Anyway, this really was my last place to ask for help, but I've tried this for 2 days now, and asked on SO and the game dev community I frequent.

Also, no, I'm only getting a timeout exception on the client after a little while, no other exceptions.

I was interested in how you were binding the server socket. The one-arg constructor for ServerSocket should definitely be binding to 0.0.0.0, so that's not the problem. Just for grins, what does System.out.println(serverSocket.getLocalSocketAddress()) show?

Are you able to connect to the server on its non-localhost address on that machine itself? If it's NAT'ed, i mean the internal one like 192.168.x.x or 10.x.x.x

I was interested in how you were binding the server socket. The one-arg constructor for ServerSocket should definitely be binding to 0.0.0.0, so that's not the problem. Just for grins, what does System.out.println(serverSocket.getLocalSocketAddress()) show?

Are you able to connect to the server on its non-localhost address on that machine itself? If it's NAT'ed, i mean the internal one like 192.168.x.x or 10.x.x.x

Good question about the local IP thing. Yes, it does connect to my 10.x.x.x IP (10.0.0.4)And the system.out.println gave me "0.0.0.0/0.0.0.0:44444" <--- that.

Sounds like the problem is somewhere on the network, perhaps with your port forwarding. Worst case is, your ISP is blocking it. If you want to PM me the public IP I can try hitting it from a couple of my addresses.

Sounds like the problem is somewhere on the network, perhaps with your port forwarding. Worst case is, your ISP is blocking it. If you want to PM me the public IP I can try hitting it from a couple of my addresses.

I don't see what else could be done here. You use ServerSocket with the int parameter, giving it 44444. Your router port-forwards 44444 to your internal IP address. Your firewall has port 44444 open. Connecting to localhost on port 44444 works. Connecting to your public IP address on port 44444 fails.

I don't see what else could be done here. You use ServerSocket with the int parameter, giving it 44444. Your router port-forwards 44444 to your internal IP address. Your firewall has port 44444 open. Connecting to localhost on port 44444 works. Connecting to your public IP address on port 44444 fails.

Have you tried connecting to your private IP address?

Yes, connecting to local host, 127.0.0.1 or 10.0.0.4 (my lan address) works perfectly.

Okay, so if you can't telnet, but port scanning sites can connect to it (and the server) what does that mean? Also, friends who have ran the client and server themselves have the same problem. I'm sure not all of them have problem networks.

Portforwarding on a router is for some reason a very brittle technology. I've had about 8 routers, and they all had nice web-interfaces that allowed you to setup portforwarding. Two of those eight actually managed to forward traffic...

You're better off renting a cheap VPS with little to no RAM, and using it solely to setup a reverse (SSH) tunnel: your desktop will connect to the VPS using TCP, and the outbound connection is used to pump traffic from the outside world to your desktop.

Hi, appreciate more people! Σ ♥ = ¾Learn how to award medals... and work your way up the social rankings!

Strange, when I disable port forwarding I get a connection refused with the client right away. Why doesn't it do that with port forwarding on? It's not connecting to the server .

probably a firewall in between, or you picked the wrong local IP, or made any other mistake in the config. it's hard to diagnose without information. the serversocket might be listening on 127.0.0.1 instead of your LAN IP.

what about specifying the local IP: new ServerSocket(InetAddress.getByAddress("10.0.0.x"), 50, 44444)

Hi, appreciate more people! Σ ♥ = ¾Learn how to award medals... and work your way up the social rankings!

I've had experiences like this with setting up a Minecraft server and I heard that you can't connect to your global IP from your own router. Because technically, the router is sending the data to itself

What I think you need to do is get a friend to try and connect and see if it works for the reason above

probably a firewall in between, or you picked the wrong local IP, or made any other mistake in the config. it's hard to diagnose without information. the serversocket might be listening on 127.0.0.1 instead of your LAN IP.

what about specifying the local IP: new ServerSocket(InetAddress.getByAddress("10.0.0.x"), 50, 44444)

Alright, I tried the normal code, then

1

newServerSocket(InetAddress.getByAddress("10.0.0.x"), 50, 44444)

. Both after turning off windows defender, all firewalls (router, and PC) and putting the router into all ports open mode.

Same results.With port forwarding enabled I got a timeout after some time, and without port forwarding I got connection refused.

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org