I’m writing a c# library for turn key network communication. I’m looking for a non-ambiguous byte that I can use in my library to indicate end of block of data. The goal would be to be able to send any file or string regardless of format. Would the Null character do it such that it won’t screw with the TCP connection and no file or string should ever have it within it’s data.
Thanks in advance.
Edit: BTW both client and server are apart of my library so it doesn’t need to comply with any other standard.
After Answers:
I’m going to make an array of X bytes then use the last byte to indicate if and where the EOF is located in the block of (X-1) bytes.
You ask the impossible
“Any file or string” can include any byte sequence.
That makes it entirely impossible to find an EOF byte. Even a byte sequence is not guaranteed to work in all cases.
Solution: File size known in advance
Send the length of data to follow as part of the communication header.
Solution: File size unknown / streaming
Define a data structure that includes a marker whether more data is to follow separate from the file contents.