I have a Socket based application using the asynchronous Sends and Receives
of the Socket class. I send out XML strings using BeginSend/EndSend from a
client end point, the server side does a BeginReceive/EndReceive.
I knew a message could be split up between Receives and I look for an end of
message marker (and continue receiving if not there) before processing the
complete message. However I was told (on this board I think) that I would not
have to deal with multiple messages in one packet. That is, I wouldn't get
[Message1]<EOM>[Message2] in the same Receive Buffer.
But that is exactly what I'm seeing. I can code for this if thats to be
expected, but I wanted to know if this is a sign of a bug, or this is really
what should/could happen with asynchronous Sockets.
Should I assume that a Receive on a given socket from a given RemoteEndpoint
is not separate and distinct messages but a continuous message stream where
one message could be broken up across multiple packets AND multiple messages
(or parts of messages) may show up in one packet?
Thanks,
Ken