QNX message and server architecture

I have the following server architecture:
client to server MsgSend() “Please send me foobar when you get it”
server MsgReceive() “ahhh, client wants foobar”

eventually foobar arrives at server
server to client MsgReply() “here’s your foobar”

foobar consists of a header and some following data. The client would like
to be able to read the header (which will tell it where to put the data),
then read the data directly into its destination buffer. I know this is
exactly what MsgRead() is intended for, but I’m on the wrong side of the
fence (can only be used on the receive side I understand). What’s the
solution?

Thanks,
Shaun

Shaun Jackman <sjackman@nospam.vortek.com> wrote:

I have the following server architecture:
client to server MsgSend() “Please send me foobar when you get it”
server MsgReceive() “ahhh, client wants foobar”

eventually foobar arrives at server
server to client MsgReply() “here’s your foobar”

foobar consists of a header and some following data. The client would like
to be able to read the header (which will tell it where to put the data),
then read the data directly into its destination buffer. I know this is
exactly what MsgRead() is intended for, but I’m on the wrong side of the
fence (can only be used on the receive side I understand). What’s the
solution?

You can’t get there from here :slight_smile:

MsgRead() will unblock only when the complete message has been transferred.
Therefore, you have two choices:
a) always set up the client/server relationship so that you know
ahead of time where the foobar data portion goes (i.e., the header
is the same size each time, and the client can receive the data
to a “well known spot”) – this may not be possible in your case…
b) have the server store the data content for foobar, and maintain
context, so that the client gets unblocked, and then, once it knows
where it should stuff the data, sends another message, this time
to fetch the data into the “well known spot”…

Cheers,
-RK


Robert Krten, PARSE Software Devices +1 613 599 8316.
Realtime Systems Architecture, Books, Video-based and Instructor-led
Training and Consulting at www.parse.com.
Email my initials at parse dot com.