I have a Java Client/server application where I share a file (tsv file) with a single client, this client can view and modify it in his UI and send back the updated version to the server. I am doing this using TCP sockets.
Now I would like to make it available to multiple client. To achieve that I wanted to use the following "protocol" : - Every time a modification is made on a client, he sends to the server the modified record with some information about the modification (EDIT, ADD, DELETE). The server receives this and send the modification to all the connected clients. - Then I make the client "listening" to the server on the socket inputstream in a separate thread, waiting for update notices.
My problem is that the communication in sockets is not working with that design. I don't know where it comes from, when I debug my code a "receive" method is blocking. I think it might be because on the client socket side I am receiving messages in two different threads on the same inputStream, is it a problem to do that ? Otherwise should I open 2 sockets with every client, one to listen for updates and one for regular use ?
If you have any other suggestion on the protocol I should use, I will be glad to hear them :)