I have made a client and server application. In that when ever i am sending data to the server,the server is receiving data,but the server goes into the block state(waits to recv data still when data sending has been completed from client) then I compulsory needs to shutdown the socket form sending data. Which I don’t want.
So can any one please tell me how to tell the server that my data transfer is completed.
My server behaves as following:
CLIENT: hi //now compulsory to shutdown the socket otherwise server
goes into block state
SERVER: hi //after this nothing can be
transferred since socket is closed
Where as i want like following:
CLIENT: hi
SERVER: hi
CLIENT: how are you?
SERVER: I am fine, thanks!
SERVER: What about you?
CLIENT: I am fine as well, thanks.
Other than setting the socket to be non-blocking, if that makes it easier, you need to develop your own protocol. This protocol would define the communications between client/server. For example, you could include data size, data, or just some form of data separator if you only use strings.