By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,732 Members | 1,429 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,732 IT Pros & Developers. It's quick & easy.

Socket EndReceive issues

P: n/a
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
Nov 21 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
I posted this to both vb.net and csharp.net communities. In the csharp
community someone responded that, yes, it is a stream and therefore can have
multiple messages in it. (i paraphrased quite a bit there).

I can code for that knowing thats what it is, but my question is, is the
stream specific to a given client and server (ie.
localEndPoint/RemoteEndPoint connection)? If I have several clients connected
to the same server port, no two clients will send messages on the same
stream, but a given client could send multiple messages on it's stream. Is
that the gist of the idea?

"Ken Foster" wrote:
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

Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.