Q
Q X
Hello everyone,
I have a problem with a client/server application where it works just
fine with 1 client, but when I try to connect to the server with
another client - it hangs.
This is what a client does when it tries to connect to the server:
//connects to the server
myClient = new Socket(InetAddress.getByName(myServer), 1234);
//create the streams for sending and receiving data
out = new ObjectOutputStream(myClient.getOutputStream());
out.flush();
//the next line HANGS!!!!
in = new ObjectInputStream(myClient.getInputStream());
It hangs with the 2nd client (didn't happen with the 1st) in the last
line of code above when it tries to get the input stream.
Does anyone know the reason for this?
Help is much appreciated.
I have a problem with a client/server application where it works just
fine with 1 client, but when I try to connect to the server with
another client - it hangs.
This is what a client does when it tries to connect to the server:
//connects to the server
myClient = new Socket(InetAddress.getByName(myServer), 1234);
//create the streams for sending and receiving data
out = new ObjectOutputStream(myClient.getOutputStream());
out.flush();
//the next line HANGS!!!!
in = new ObjectInputStream(myClient.getInputStream());
It hangs with the 2nd client (didn't happen with the 1st) in the last
line of code above when it tries to get the input stream.
Does anyone know the reason for this?
Help is much appreciated.