Imagine we create simple client-server app to send files from client to server. We use boost asio.
Server starts listening. Client connects to the server. Client send filename and file content.
But server receive just a stream of bytes. How server detect end of filename and start of file content?
First idea I have is to use special delimiter. Client writes into the socket filename, then delimiter, then file content. Server uses 'read_until' to receive filename and 'read' to read file content.
Is it a good solution?
What if I want to sent 10 files in a row - searching for delimiter in the byte stream may be expensive...