Question about network MsgReceive()

I had read the doc.
"Receiving a message from a sender on another node of the native QNX
network, it’s possible that the number of bytes received could be smaller
than both what the sender was sending and what the receiver was asking for.
"
from
http://qdn.qnx.com/support/docs/mig4nto/guide/programming.html#RECEIVENET

"But in the networked case, the message is received by the client’s npm-qnet
into its own private buffers and then sent via transport to the remote
npm-qnet. Since the size of the server’s receive data area can’t be known in
advance by the client’s npm-qnet when the message is sent, only a fixed
maximum size (currently 8K) message is transferred between the client and
the server. "
from http://qdn.qnx.com/support/docs/neutrino/lib_ref/m/msgreceive.html

Is it mean that if the message across the network is bounded by 8K , the
number of byte received and send must be the same?
And if the message is not received completely and an reply is issued, the
remaining part of the message is simply ignore or error will be occur?

waity <waity@hongkong.com> wrote:

I had read the doc.
"Receiving a message from a sender on another node of the native QNX
network, it’s possible that the number of bytes received could be smaller
than both what the sender was sending and what the receiver was asking for.
"
from
http://qdn.qnx.com/support/docs/mig4nto/guide/programming.html#RECEIVENET

"But in the networked case, the message is received by the client’s npm-qnet
into its own private buffers and then sent via transport to the remote
npm-qnet. Since the size of the server’s receive data area can’t be known in
advance by the client’s npm-qnet when the message is sent, only a fixed
maximum size (currently 8K) message is transferred between the client and
the server. "
from > http://qdn.qnx.com/support/docs/neutrino/lib_ref/m/msgreceive.html

Is it mean that if the message across the network is bounded by 8K , the
number of byte received and send must be the same?
And if the message is not received completely and an reply is issued, the
remaining part of the message is simply ignore or error will be occur?

If sender/receiver are on same node, the kernel (who copies sender’s
data into receiver’s buffer) have the contral of “how much to copy”.
It is always “min(nbytes sender send, nbytes receiver buffer)”.

However, in network case, the sender party (neither kernel nor qnet)
know the receiver’s buffer size. To avoid sending “too much” cross
network (and then the receiver simple discard them), QNET always try
to send “min(nbytes sender send, 8K)” (well it’s actually 8k - sizeof(some
qnet header)).

What happens to the receiver is, after MsgReceive(), it should
always check info.srcmsglen, and info.msglen. It tells you how
many bytes sender is going to send, and how many bytes you have
received. If the receiver think he could receive more (he have
a large buffer), receiver simply issue MsgRead() to get the extra.

And to your last question, if receiver choose “MsgReply()” before
receiving all the data sender try to send. It is totally OK, and
no error will generate. (MsgSend/Receive/Reply do not inforce all
the data being transfered, it is the problem/decision between sender and
receiver)

-xtang

Thx for answering.
I have a server program and different client program run in different hosts.
There is a main loop in the server to receive message from client process.
Everytime the server receive the message, the rcvid will be recorded and the
client is reply block .And the server continue to receive message from other
clients. Error occur when the server use the rcvid recorded to reply the
client. The server prompt reply error and client prompt send error at the
same time when server try to reply the client.
Any idea about the bug? In what condition reply function call will cause
error in the send function call? I’m sure the rcvid is unchanged between
the receive and reply operations.
Thank you very much.

“Xiaodan Tang” <xtang@qnx.com> ¼¶¼g©ó¶l¥ó·s»D:9tb8pc$98u$1@nntp.qnx.com

waity <> waity@hongkong.com> > wrote:
I had read the doc.
"Receiving a message from a sender on another node of the native QNX
network, it’s possible that the number of bytes received could be
smaller
than both what the sender was sending and what the receiver was asking
for.
"
from

http://qdn.qnx.com/support/docs/mig4nto/guide/programming.html#RECEIVENET

"But in the networked case, the message is received by the client’s
npm-qnet
into its own private buffers and then sent via transport to the remote
npm-qnet. Since the size of the server’s receive data area can’t be
known in
advance by the client’s npm-qnet when the message is sent, only a fixed
maximum size (currently 8K) message is transferred between the client
and
the server. "
from > http://qdn.qnx.com/support/docs/neutrino/lib_ref/m/msgreceive.html

Is it mean that if the message across the network is bounded by 8K , the
number of byte received and send must be the same?
And if the message is not received completely and an reply is issued,
the
remaining part of the message is simply ignore or error will be occur?

If sender/receiver are on same node, the kernel (who copies sender’s
data into receiver’s buffer) have the contral of “how much to copy”.
It is always “min(nbytes sender send, nbytes receiver buffer)”.

However, in network case, the sender party (neither kernel nor qnet)
know the receiver’s buffer size. To avoid sending “too much” cross
network (and then the receiver simple discard them), QNET always try
to send “min(nbytes sender send, 8K)” (well it’s actually 8k - sizeof(some
qnet header)).

What happens to the receiver is, after MsgReceive(), it should
always check info.srcmsglen, and info.msglen. It tells you how
many bytes sender is going to send, and how many bytes you have
received. If the receiver think he could receive more (he have
a large buffer), receiver simply issue MsgRead() to get the extra.

And to your last question, if receiver choose “MsgReply()” before
receiving all the data sender try to send. It is totally OK, and
no error will generate. (MsgSend/Receive/Reply do not inforce all
the data being transfered, it is the problem/decision between sender and
receiver)

-xtang

waity <waity@hongkong.com> wrote:

Thx for answering.
I have a server program and different client program run in different hosts.
There is a main loop in the server to receive message from client process.
Everytime the server receive the message, the rcvid will be recorded and the
client is reply block .And the server continue to receive message from other
clients. Error occur when the server use the rcvid recorded to reply the
client. The server prompt reply error and client prompt send error at the
same time when server try to reply the client.
Any idea about the bug? In what condition reply function call will cause
error in the send function call? I’m sure the rcvid is unchanged between
the receive and reply operations.

We will need more detail information.

What exactly is the error MsgReply() returned? What exactly is the
error MsgSend() returned? What is the “status” you MsgReply() back?

-xtang

Thank you very much.

“Xiaodan Tang” <> xtang@qnx.com> > ¼¶¼g©ó¶l¥ó·s»D:9tb8pc$98u$> 1@nntp.qnx.com> …
waity <> waity@hongkong.com> > wrote:
I had read the doc.
"Receiving a message from a sender on another node of the native QNX
network, it’s possible that the number of bytes received could be
smaller
than both what the sender was sending and what the receiver was asking
for.
"
from

http://qdn.qnx.com/support/docs/mig4nto/guide/programming.html#RECEIVENET

"But in the networked case, the message is received by the client’s
npm-qnet
into its own private buffers and then sent via transport to the remote
npm-qnet. Since the size of the server’s receive data area can’t be
known in
advance by the client’s npm-qnet when the message is sent, only a fixed
maximum size (currently 8K) message is transferred between the client
and
the server. "
from > http://qdn.qnx.com/support/docs/neutrino/lib_ref/m/msgreceive.html

Is it mean that if the message across the network is bounded by 8K , the
number of byte received and send must be the same?
And if the message is not received completely and an reply is issued,
the
remaining part of the message is simply ignore or error will be occur?

If sender/receiver are on same node, the kernel (who copies sender’s
data into receiver’s buffer) have the contral of “how much to copy”.
It is always “min(nbytes sender send, nbytes receiver buffer)”.

However, in network case, the sender party (neither kernel nor qnet)
know the receiver’s buffer size. To avoid sending “too much” cross
network (and then the receiver simple discard them), QNET always try
to send “min(nbytes sender send, 8K)” (well it’s actually 8k - sizeof(some
qnet header)).

What happens to the receiver is, after MsgReceive(), it should
always check info.srcmsglen, and info.msglen. It tells you how
many bytes sender is going to send, and how many bytes you have
received. If the receiver think he could receive more (he have
a large buffer), receiver simply issue MsgRead() to get the extra.

And to your last question, if receiver choose “MsgReply()” before
receiving all the data sender try to send. It is totally OK, and
no error will generate. (MsgSend/Receive/Reply do not inforce all
the data being transfered, it is the problem/decision between sender and
receiver)

-xtang