Home
Developer Resources
QNX RTOS v4
QNX RTOS v4 Knowledge Base

QNX RTOS v4 Knowledge Base

Foundry27
Foundry27
QNX RTOS v4 project
Resources

QNX RTOS v4 Knowledge Base

Title Resizing the maximum message size of an input handler
Ref. No. QNX.000009883
Category(ies) Development
Issue What is the technique for receiving messages into an input handler (PtAppAddInput()) that is larger then the 1064 bytes?

We want to be able to send a 4K structure from another application, but the input handler function is only getting 1064 bytes.

Solution Here is a section that has been added to the Programmer's Guide:
x09Arguments to your input function include:
x09msg - a pointer to an event buffer that was used to receive the message.
x09msglen - the size of the buffer.
x09
x09This buffer might not be large enough to hold the entire message. One way of handling this is to have the first two bytes of the message indicate the message type, and from that determine how big the message should be. Once you know the message size, you can:
x09Reread the entire message. Under QNX4, this can be done by calling Readmsg(). Under Neutrino, this can be done by calling MsgReadv().
or
x09Copy the part you've already received into a new buffer. Get the rest of the message(by calling Readmsg() under QNX4, or MsgReadv() under Neutrino. Add the rest of the message to the first part.

Alternatively, you can set the event buffer to be the size of the largest message your application will receive(if known).
This can be done by calling PtResizeEventMsg(). You'd typically call this before you expect to receive any messages.

NOTE: PtResizeEventMsg() won't reduce the message buffer beyond a certain minimum size. THis is so thet the widget library will continue to function.