I have a client serever application,
My server accepts connections from more than one clients.
After a client is connected to server it sends command to the server and the sever sends replies
the replies are either strings or files.
On the server side after accepting connection,
there is a socket (seperate from listening socket) which is responsible for communication with client.
On the client side after a client sends a command to server, I start reading for the response on the same socket.
Now my problem is with files,
client sends a command to server asking for file, the server starts responding by sending binary data of file, if file is all good it transfers fine,
But if on the server side in the middle of file transfer the server gets a read problem, it has no way to infrom that problem to client, because this is a one to one socket communication… the client will treat any incoming data as if it is a file data untill the file size sent in the start is not complete.,
I am sure this could be a recurring pattern how to can I resolve this ?
FTP does this by having two connections: a command connection and a data connection.