Mario Charest <mcz@videotron.ca> wrote:
“Brian Stecher” <> bstecher@qnx.com> > wrote in message
news:8qsvju$j5m$> 1@nntp.qnx.com> …
Mario Charest <> mcz@videotron.ca> > wrote:
I could find anywhere in the doc the maximum size of a message,
MsgSend()
Is there a difference if message is local or goes across network.
There’s no max size per say, but a MsgReceive*() from a remote client
will only return the first 8K of a message, no matter how big the original
message was. The remainder of the message can be obtained by using the
MsgRead*() functions (all in one fell swoop if you want). The rationale
for this is to prevent the OS from having to buffer a multi-megabyte
message until the server does a receive. It shouldn’t cause too much
grief for people since most servers just do a MsgReceive*() to get the
message header and then a MsgRead*() to get any big data portion of
the message.
Ok, Mr documentation, are ya listening >
One think isn’t clear in my mind Brian, why would the OS need to buffer?
Locally, of course, the kernel doesn’t need to – it can know the state
and size of the buffers involved – and a memory to memory copy is cheap
and fast.
But, accross the network, moving data is slow. Often someone will do
a MsgSend() before the receiving side has done a MsgReceive(). So,
we have a few choices:
– only send notification that a status has changed, then wait until
receiver calls MsgReceive() and start copying the data accross the
network
– starting sending the whole message at the time of the MsgSend() and
buffer it on the receiving side (the OS doing the buffering, or, well,
qnet in io-net)… of course, the data requirements for qnet could
very big. (This is what QNX4 does – but the message is limitted to
(just under) 64k in size, limiting the amount of buffer that needs
to be created.)
– starting sending the message immediately, but only send the first
(limitted amount) of the message. This limits the latency – if
you pick your buffer size right, most messages will fit in it. It
limits your buffering overhead – no message will take more than
a certain size.
-David