I have a two java programs, one a server and one a client that have no problems communicating over a LAN, but they seem unable to interact over internet.
The server program's socket line is
ServerSocket s = new ServerSocket(serverPort,backLog,InetAddress.getByName(serverIp));
and the client's line is
Socket s = new Socket(serverAddress,serverPort);
I get no errors on the server side, but the client side socket never fails to give me
java.net.ConnectException: Connection timed out: connect
after a few seconds.
The netstat -a command when run on the server gives me
TCP 172.31.26.69:2674 WIN-CHU42MQF3R4:0 LISTENING
which I believe means the ServerSocket is listening to any internet communications directed at port 2674. Again, this program works perfectly when run on my LAN, it just cannot communicate over the internet.
I've confirmed no other programs on both computers are using port 2674, and I've allowed all forms and ports of communication on the AWS server as well as opening port 2674 on my own firewall. But I cannot think of anything else that might be causing the issue. Is there anything that might interfere?