Hello all,
I am trying to create a server and a client using socket and serversocket. I'm spawning a new
thread on serversocket.accept(), no problem there. My problem is as follows:
Each communiction from the server and a client is an object, currently sent using objectin/outputstreams.
I have no problems doing one iteration of client-write, server-read, server write, client-read.
but i don't know how many things the client will send to a server.
the client could send a request, wait for a response, send another request, get another response, etc.
I have a while loop, dong readObject/writeObject.
The readObject() doesn't seem to be blocking when reading from the socket on client/server side. So while the client is processing whatever the server sent, i get null reads on the server. Is there any way for me to block on the server/client on the readObject() until the other side sends something?
Thank you.