I need to send some files over a socket and I'm trying to figure out how to do it. It's pretty easy to send a single file, but I need to, once I'm connected, send an integer that represent a file unique id and after that send file content. Once completed, I have to send another id with its file content. So I need to have something like this:
- Connect
- If there aren't file to send go to 6
- Send id
- Send file
- Go to 2
- Close connection
Most of the solutions that I've found to send files use a byte[] as buffer and I don't know how to differentiate the id from the file content. What can I do?