I certainly hope this solves your problem but it's essentially Already what I do. A client sends a connection request to the dispatcher which is constantly listening. The dispatcher creates a new thread for the server that will serve the client. The client and server exchange messages and then exchange files if there are any to exchange. Once this is done the connection is closed. Any new client requests are serviced through a new socket. The problem I have is definitely NOT about the connection being closed since information is still passed over the socket, it just happens that the client seems to prematurely or not completely read the file bytes SOMETIMES.

Anyway, I do hope this really you have solved your problem.