SocketAsyncEventArgs and buffering while messages are in parts

Posted by Rob on Stack Overflow See other posts from Stack Overflow or by Rob
Published on 2010-05-24T13:42:52Z Indexed on 2010/05/24 18:01 UTC
Read the original article Hit count: 260

Filed under:
|
|
|

C# socket server, which has roughly 200 - 500 active connections, each one constantly sending messages to our server.

About 70% of the time the messages are handled fine (in the correct order etc), however in the other 30% of cases we have jumbled up messages and things get screwed up. We should note that some clients send data in unicode and others in ASCII, so that's handled as well.

Messages sent to the server are a variable length string which end in a char3, it's the char3 that we break on, other than that we keep receiving data.

Could anyone shed any light on our ProcessReceive code and see what could possibly be causing us issues and how we can solve this small issue (here's hoping it's a small issue!)

Code below:

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET