Hey :) First off this might actually be a network problem! But im also uncertain of the java code and how networking works in java. The program is basically just to transfer a file if that matters! So this is my code for setting up the connections:
//connection(s) private ServerSocket listener; //used to listen private Socket connection; //Opens the actual connection //variables private final int PORT = 443; //ports 80 / 443 / 3306/ 3389 is open on 83.170.73.***. //** constructor code and so forth nothing related to the connection part listener = new ServerSocket(PORT); text.append("Listening for new connections on: " + PORT); // updates a textfield for GUI //accept one incoming connection connection = listener.accept(); //open streams and use the connection
//connection info private String REMOTE_MACHINE = "127.0.0.1"; //"83.170.73.***"; private int port = 443; //ports 443 / 3306/ 3389 is open on 83.170.73.***. //*constructor code, nothing related to the connection. connection = new Socket(REMOTE_MACHINE, port); text.append("\nConnected"); // updates a text field for the GUI //*open streams and use the connection
Since its only a few lines of code theres actually involved i think it might be a network problem, but according to http://www.yougetsignal.com/tools/open-ports/ atleast the ports in the comments above is open and should work. I dont have a firewall other than windows and the JVM is allowed through there (i assume its not individual .jar files i need to allow?).
My program works beatutifully when i use the local ip (127.0.0.1) but when i use the external ip it tries to connect for 10 seconds or so and then returns an EOFException or a ConnectException.
Is the code i did right? If so is there any other methods of setting up a connection that is more reliable(/easier for my stupid ISP to handle :) ).
Thanks in advance!