Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Receive length of messages: (4 Items)
   
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?

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!
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!


Re: Receive length of messages  
> 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.

Thanks, I'll consider this.  At the moment I'm using this to return error codes and these are positive but this would 
work if all error codes were negative, or if we return the status in the message itself.

Regards,
Chris
RE: Receive length of messages  
Error codes should be returned via MsgError().

Regards,

-seanb

-----Original Message-----
From: Chris Trobridge [mailto:community-noreply@qnx.com]
Sent: Thu 6/24/2010 4:53 AM
To: ostech-core_os
Subject: Re: Receive length of messages
 
> 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.

Thanks, I'll consider this.  At the moment I'm using this to return error codes and these are positive but this would 
work if all error codes were negative, or if we return the status in the message itself.

Regards,
Chris




_______________________________________________

OSTech
http://community.qnx.com/sf/go/post57754


Attachment: Text winmail.dat 2.66 KB