|
|
Re: Receive length of messages
|
|
06/24/2010 1:30 AM
post57748
|
Re: Receive length of messages
> When using MsgSend() MsgReceive() you can specify the size of the message
> sent and the size of the receive buffer but there is no indication of how many
> bytes were written into the receive buffer by MsgReply().
>
> You can obtain this information after MsgReceive but the client cannot
> determine it after MsgSend(). There's no particular way that the client can
> determine that the server has responded with the expected number of bytes.
>
> What is assumed?
You can use the status para from MsgReply to control the return-value of MsgSend.
If you put the length of your message in the status para, MsgSend will return it.
>
> Is it assumed that the server will check the receive buffer and return an
> error if there is inadequate space (and hence the client 'trusts' the server
> to send the right amount of data).
>
> Should messages include lengths and integrity checks?
>
> Or is this situation comparable to knowing the length of the message received
> but still not knowing that the server actually wrote that much data in its
> transmit buffer?
>
> In any case, is it thus a good idea to zero your MsgSend() receive buffer to
> avoid re-reading old data in the event that no reply is written?
>
> Thanks!
|
|
|
|
|