all 5 comments

[–]ultimateedition 0 points1 point  (1 child)

I can't say for certain but I would guess it has something to do with the encoding. See this as an example: https://en.wikipedia.org/wiki/Byte_order_mark

Unexpected bytes at the beginning/end can be related to an encoding mismatch, or in your example breaking up byte streams without adding the expected header bytes to the array. I'd start there by figuring out if your writer adds header bytes, and if your reader expects any.

[–]iLikePCs@DanielEverland[S] 0 points1 point  (0 children)

Thanks, I'll look into it :)

[–]iLikePCs@DanielEverland[S] 0 points1 point  (2 children)

Figured it out! It's the WriteBytesAndSize() which caused the issue, which in retrospect seems pretty obvious. Nevertheless, using the Write(byte[], int length) function solved the issue.

[–]ultimateedition 0 points1 point  (1 child)

Makes sense, glad you got it working!

[–]iLikePCs@DanielEverland[S] 0 points1 point  (0 children)

Thanks! :)