Re: CSocket problem
From: Riverwind (riverwind_at_heaven-dk.NEJ_TIL_SPAM)
Date: 06/10/04
- Next message: Riverwind: "Re: CSocket problem"
- Previous message: Joseph M. Newcomer: "Re: Who'd like to give me a sample support multilanguage?"
- In reply to: Joseph M. Newcomer: "Re: CSocket problem"
- Next in thread: Joseph M. Newcomer: "Re: CSocket problem"
- Reply: Joseph M. Newcomer: "Re: CSocket problem"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 11 Jun 2004 00:05:06 +0200
"Joseph M. Newcomer" <newcomer@flounder.com> skrev i en meddelelse
news:933hc0pgkiofrbevdpd3b086735lo3inoa@4ax.com...
> You have confused "message" with "stream". A byte stream means exactly
that: you get a
> stream of bytes. The amount you receive in a given receive call has
nothing to do with the
> number that were sent by a send call. It is ALWAYS legitimate for a
receive call to return
> you fewer bytes than a send call; you must do multiple receive calls to
get the data you
> want.
>
> The only guarantee TCP gives you is that eventually, through a sequence of
receive
> operations, you will receive every byte that was sent, in order, with no
duplicates and no
> drops, or both the sender and the receiver will get an error code
indicating this could
> not be done. Otherwise, there are no promises. You have assumed that if
you send, say, 8K
> bytes, your receive will receive 8K bytes. This is extremely unlikely.
>
> You will have to put in some form of message delimiter, byte count, or
something else, if
> you want to impose some concept of :"message" on the byte stream. TCP has
no concept of
> messages, and has no responsibility to deliver other than what it
promises.
> joe
Maybe I was a bit vague in describing the problem, but the application does
interpret the byte stream as messages, through a count, which tells me
exactly how long the message is, so basically I have no problem with
messages split over several calls to Receive(..). I will have to check the
sender code to see if it handles the WSAEWOULDBLOCK return value, as Scott
writes.
Right now the problem is that apperantly some bytes are lost, and I will go
totally off track reading the message length.
Thanks for the help.
/Riverwind
- Next message: Riverwind: "Re: CSocket problem"
- Previous message: Joseph M. Newcomer: "Re: Who'd like to give me a sample support multilanguage?"
- In reply to: Joseph M. Newcomer: "Re: CSocket problem"
- Next in thread: Joseph M. Newcomer: "Re: CSocket problem"
- Reply: Joseph M. Newcomer: "Re: CSocket problem"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|