I use NSStream to send data over through MCSession, this works fine 99%, however sometimes i get trash on the receiver's end
I write
First 4 bytes is the hash
Next 4 bytes is the content length
Rest the data
in case of trash, i get wild values like the content length too large, hash incorrect...
How to defend against such input? now i can check that hash don't match, but a problem can raise, if the "content length" gets larger than the buffer
Note: that NSStreamEventErrorOccurred doe not get triggered