Reputation: 75
I am creating a file server and need to have several clients send images to a server. In the client send method, I am shutting down the socket after the image has been sent to tell the server to stop receiving. Is it possible to keep the same socket connection for the next time that client sends an image rather than reconnecting with a new socket?
Upvotes: 0
Views: 524
Reputation: 149155
No. A shutdown
is a definitive operation at the underlying socket library level. It is not intended to be used as a transfert acknowledgment, but only as part or a graceful shutdown.
If you want to re-use the connection, you must use a different protocol to signal the end of transmission. Common usages are size + data (binary protocol) or commands and encoded data (text protocol).
Upvotes: 1