Stops when opening ObjectInputStream
Hello,
My server stops after a client is connected, a socket is opened and when its about to open a ObjectInputStream. I checked it with short messages to the console that it just stalls before doing that. Here is the bit of code that it stops: Code:
public void listen(){
try{
server = new ServerSocket(4321);
System.out.println(server.getInetAddress());
}
catch(IOException e){
System.out.println(e);
}
while(true){
listensocket();
}
}
public void listensocket(){
//Server accepts client
try{
clientsocket = server.accept();
}
catch(IOException e){
System.out.println("Port not accepter: 4321");
System.exit(-1);
}
//Server begins to receive and gets ready to send
try{
//the program stops here
input = new ObjectInputStream(clientsocket.getInputStream());
output = new ObjectOutputStream(clientsocket.getOutputStream());
}