Posted on 2004-08-19
I have a client server Java application. The client must synchronise data with the server and then close a connection.
Here is a brief summary of the steps :
The client connects to the server socket app and send a START string. The server responds with a READY string. The client then sends it's data to the server . The server will call readUTF() until the client sends data which includes a special terminating character. the problem is the data with the terminating character in it may get lost and never reach the server. As a result the server is waiting forever, deadlocked. the client too cannot proceed until it has a response from the server. The client too may become locked if the server's READY string never reaches it.
At the moment I am developing on our LAN and communication is fine, no packets get lost and it all works fine, but the final version is over GPRS and I'm concerned that packets will get lost.
Could someone advice as to how to prevent should deadlock occuring ?