Writing to Remote Message Queues

Hi,

Is there a way to write to remote message queues on QNX 6.2.0?

We have an application that communicates using mqd_t type message
queues. We want to split the application so that it can be run on two
machines. Robert Krten’s book, “Getting Started with QNX Neutrino 2”,
talks about opening files on remote hosts using the following idiom:

fd = open("/net/hostname/path/to/file", oflags);

Can we use a similar idiom with mq_open()? If not, is there another way
to do it?

…Stephen

Stephen Rasku <spr@shaw.ca> wrote in message
news:buhqgm$ddk$1@inn.qnx.com

Hi,

Is there a way to write to remote message queues on QNX 6.2.0?

We have an application that communicates using mqd_t type message
queues. We want to split the application so that it can be run on two
machines. Robert Krten’s book, “Getting Started with QNX Neutrino 2”,
talks about opening files on remote hosts using the following idiom:

fd = open("/net/hostname/path/to/file", oflags);

Can we use a similar idiom with mq_open()? If not, is there another way

Yes. Just mqd = mq_open("/net/hostname/dev/mqueue/myqueue_name", …)
should
work.

-xtang

to do it?

…Stephen

In article <bujm7b$8f2$1@nntp.qnx.com>, Xiaodan Tang wrote:

Yes. Just mqd = mq_open("/net/hostname/dev/mqueue/myqueue_name", …)
should
work.

I get:

mq_open(/net/wiggum/dev/mqueue/srasku): No such file or directory

when I try and do this.

However, if I do it locally (i.e. mq_open(/srasku)) from the same program,
it works fine. Is there something else I need to do?

…Stephen

Stephen Rasku <spr@shaw.ca> wrote:

In article <bujm7b$8f2$> 1@nntp.qnx.com> >, Xiaodan Tang wrote:

Yes. Just mqd = mq_open("/net/hostname/dev/mqueue/myqueue_name", …)
should
work.


I get:

mq_open(/net/wiggum/dev/mqueue/srasku): No such file or directory

when I try and do this.

However, if I do it locally (i.e. mq_open(/srasku)) from the same program,
it works fine. Is there something else I need to do?

Hm… it might be something that didn’t work in 6.2.0, but now works.

Or it may be that the create on the name has to be done locally, and
after that access can be gained accross the net, I’m not sure.

YOu might try a local mq_open( O_CREAT), and the remote open after that.
If that doesn’t work, it is something that was added/fixed/enhanced between
6.2.0 and 6.2.1B, because I’ve recently tested that situation under 6.2.1B.

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.

In article <bukj50$5pg$1@nntp.qnx.com>, David Gibbs wrote:

Hm… it might be something that didn’t work in 6.2.0, but now works.

Or it may be that the create on the name has to be done locally, and
after that access can be gained accross the net, I’m not sure.

YOu might try a local mq_open( O_CREAT), and the remote open after that.
If that doesn’t work, it is something that was added/fixed/enhanced between
6.2.0 and 6.2.1B, because I’ve recently tested that situation under 6.2.1B.

I get:

mq_open(/net/wiggum/dev/mqueue/srasku) #14: Bad address

when I try and do this.

Here’s the modified logic that I tried to do this.

mqd_t mqd;
int iFlags = O_WRONLY;
if (0 == strncmp(pStrOutputMsgQueue, “/net/”, 5))
{
iFlags |= O_CREAT;
fprintf(stderr, “Have to create queue %s (0x%x)\n”,
pStrOutputMsgQueue, iFlags);
}
if ( (mqd = mq_open(pStrOutputMsgQueue, iFlags) ) == -1)
{
char err[80];
snprintf(err, sizeof(err), “mq_open(%s) #%d”, pStrOutputMsgQueue,
errno);
perror(err);
}

Did I make a mistake?

…Stephen