So I am running a piece of code that is supposed to create a Socket a ServerSocket, when I run my code it meets a stand still at line 14 but doesn't throw any exception. What have I missed?
public class Syncronizer {
InputStream instr = null;
PrintStream prnstr = null;
BufferedReader br = null;
DataInputStream in;
DataOutputStream out;
ServerSocket TCPServerSocket;
public Syncronizer() {
try {
instr = System.in;
br = new BufferedReader(new InputStreamReader(instr));
TCPServerSocket = new ServerSocket(7007);
Socket clientSocket = TCPServerSocket.accept();
in = new DataInputStream(clientSocket.getInputStream());
out = new DataOutputStream(clientSocket.getOutputStream());
} catch (Exception e) {
e.printStackTrace();
}
}
...
}
Just to spare you the counting it is this line that halts my program:
Socket clientSocket = TCPServerSocket.accept();
EDIT: With halt I mean that my program still runs but doesn't go beyond this point in the code just like a infinite loop.