BinarySerializer
BinarySerializer copied to clipboard
Thead-safety
Hi,
So I've been using the serializer with threads & hi-speed packets and after a while there seems to be corruption (the serializer spits out mal-formed packets). The issue was resolved after I locked the serialize() function call. Also, I'm using the same serializer object for all calls.
So, my question is, is the serializer thread-safe? is there any common practice you suggest in scenarios like this?
George.
It should be but it’s possible there’s a bug. Actually, now that I think about it I wonder if there’s a thread safety issue in the bit handling. I didn’t even think about that. Are you using bit fields?
Nope.
I can send you my code + Wireshark recording if that helps... Again this happens only in serialization and not deserialization
That would be great. I’ll get to it as soon as possible
Is there a private way to send you info? Can I have your email?
Can you setup a private repo and give me access? They're free now.
I haven't been able to reproduce this so if you can post some code I'd like to take a look. Thanks
Look at NcpSharp.Server, SendPacket (you can look for the lock statement, without it everything crashes)