Message Queue and Photon


I’m kind of a newbie on Qnx…

I’m trying to develop a little interface (some text boxes and buttons) in order to control a driver I’m developing…

So I was trying to develop a Photon Application and to exchange data with my driver application through message queues…

But if my driver succeeds in creating a queue, the Photon App never achieves to open it…(errno = 2 on mq_open)

So I tried just to create by the Photon App… impossible : ErrNo = ENOSYS !

Anybody could help me please with this ?


PS : Don’t know if this was more a GUI Topic rather than here…but seems more logical to be here…


Can you post the code you use to open the mqueue queues. Both in your driver and in the Photon app.

Hard to tell what’s wrong without seeing the code.


Hello Tim,

Thanks for your answer… fuuny it came the same time I found my mistake…and I’m a little bit ashamed of it !
In my Photon App I forgot to include LIBS += mq …on the other hand I did it in my driver App…
And so the Photon App was trying to use the mq queue server as the driver was using mqueue queue server… which was the only one running…
A stupid error but it took some time to discover it !
Anyway perhaps my experience will help some other newbie !
Thanks again for trying to help !

A majority of problems are of this type, however discovering the problem often requires a more sophisticated investigation. That or someone looking over your shoulder.

Yeah right !
Unfortunately, I’m coming again searching for some help…let’s hope that won’t be as stupid as before…;)

So I managed to make my driver app and my photon app discuss…

Next step is so to have my driver app on a computer which can carry the card I want to “drive” …and the Photon app on a VmWare on my computer…

On each machine I did a “mount -T io-pkt” so that they appear in /net (let’s say pc1 and pc2 )

Nom my problem is : DriverApp open and creates a queue : “/FromInterface” with : (it’s on pc1)
Q_FromInterface = mq_open( “/FromInterface”, O_CREAT| O_RDONLY ,S_IRWXU | S_IRWXG | S_IRWXO,NULL);

and the PhotonApp tries to open it :
Q_Out = mq_open( “/net/pc1/dev/mq/FromInterface”, O_WRONLY);

it never connects ! Always an errno = 2 …

Am I missing something that is possible on a single machine that cannot be done on 2 ? Thanks for any tip


I’m not sure about this, but I think that mq may not support queues across the network like this, although mqueue will.
mqueue would be slightly slower, but an insignificant amount given that you will have network transmission delay.

Ok seems to be ok ! That was finally stupid too…avan if after I read the doc again and again and did not see this ! Thanks.

is mq_timedreceive working with mqueue ?

Because …I launch my Queue on pc1 :

On Pc2 : Photon App :
Initialisation : [code] printf("\t\tInterface : Opening Receiving Queue\n");
QDesc_ToInterface = mq_open( pcToInterfaceQueueName, O_RDONLY);// ,S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP,NULL);
with pcToInterfaceQName = “/net/pc1/dev/mqueueTO_INTERFACE_QUEUE_NAME”

    if (QueueDescriptor_ToInterface != -1)
        printf("\t\tInterface : Creating Receiving thread now.\n");
        Ret = pthread_create(&ToInterface_ThreadPtr, NULL, &ToInterfaceTask ,NULL);

        if (Ret !=EOK )
            Error = errno;
            printf("\t\tInterface : Error on Creating Receiving thread Error = %d. Errno = %d\n",Ret,Error);
            pthread_mutex_init(&exit_mutex, NULL);
            printf("\t\tInterface : Receiving Thread was created. (%d) \n ",ToInterface_ThreadPtr);
        Error = errno;
        printf("\t\tInterface : Invalid Receiving Queue  errno = %d \n",Error);

Receiving Thread :

[code]while (bOk && !Error)
clock_gettime(CLOCK_REALTIME, &tm);
tm.tv_sec += 5;

printf("\t\tInterface : Ready to receive %d\n",tm.tv_sec );
MessageSize = mq_timedreceive( QueueDescriptor_ToInterface, buf, 4096, NULL,&tm );

if (MessageSize < 0)
    printf("\t\tInterface : Nothing \n");         
    if (MessageSize < 4096)
        buf[MessageSize] = 0;
        buf[4096-1] = 0;

    printf("\t\tInterface : buf = %s \n",buf);

    if (bOk)
        printf("\t\tInterface : Mutex ForceQuit %d\n",ForceQuit);
        pthread_mutex_lock( &exit_mutex );
        if (ForceQuit)
            printf("\t\tInterface : ForceQuit \n");
            bOk = 0;
        pthread_mutex_unlock( &exit_mutex  );

if (QDesc_ToInterface != -1)
    printf("\t\tInterface : closing Receiving Queue\n");

An the same machine…everuthing goes fine…
But on 2 Pcs… it blocks :
it goas 2 times in ready to receive (printf("\t\tInterface : Ready to receive %d\n",tm.tv_sec ):wink:
but seems to never go out of mq_timedreceive …strange…any idea on what I did wrong ?

Yes. You should check the help under “Managing POSIX Message Queues” for differences between mqueue and mq.

It sounds like something is different on how the two systems are setup.