how to handle multiple-message-in-same data-buffer (async programming)
- From: asharda@xxxxxxxxxx
- Date: Tue, 18 Mar 2008 14:31:13 -0700 (PDT)
Hello,
I have written a sample async code (using callback/async).
I am now seeing a situation where-in if two messages are received at
the same-time, both of them show-up in the data-buffer.
Given that i am new to this, can you point to resources or suggest
ways to handle this scenario? (the program runs indefinitely, handling
messages as they come in).
Here is the statement that stores the incoming bytes into a string:
myCompleteMessage = String.Concat(myCompleteMessage,
Encoding.ASCII.GetString(m_DataBuffer, 0, bytesRead));
Note that m_DataBuffer is a byte-array //byte[] m_DataBuffer = new
byte[20000];
There is 'content-length' field in the data that i get, but not sure
how to go-about handling both (or multiple) messages.
Thanks for your time.
Regards,
RS
.
- Follow-Ups:
- Re: how to handle multiple-message-in-same data-buffer (async programming)
- From: Peter Duniho
- Re: how to handle multiple-message-in-same data-buffer (async programming)
- Prev by Date: Re: Need to traverse an object structure using Reflection
- Next by Date: Re: Use of Array vs. BindingList vs Queue in data acquisition system
- Previous by thread: creating ExecuteQuery method
- Next by thread: Re: how to handle multiple-message-in-same data-buffer (async programming)
- Index(es):