UNIX Socket FAQ

A forum for questions and answers about network programming on Linux and all other Unix-like systems

You are not logged in.

#1 2010-02-01 08:53 AM

chriskr7
Member
Registered: 2010-01-19
Posts: 2

Re: Msg Queue(IPC) Problem

Hi, Gurus,

I'm trying to send a string ex) "Can you hear me?"

to other process by message queue in infinite loop.

However, I have a problem to work it right.

Will you please look at attached zip file and

tell me what's wrong with my code?

They are simple so it won't bother you much.

Thanks in advance.

Offline

#2 2010-02-01 02:16 PM

RobSeace
Administrator
From: Boston, MA
Registered: 2002-06-12
Posts: 3,839
Website

Re: Msg Queue(IPC) Problem

I know very little about those ancient SysV IPC methods, and never use them for
anything myself...  (There are so many superior methods of IPC, why on Earth would
you use something with such an ugly and lame interface?)

However, THIS is clearly wrong:

if(key = ftok("test1.cpp", 'Z') == -1)

You need surrounding parenthesis around the assignment...  As it is, you're assigning
to "key" the boolean result of that comparison against -1; ie: either 0 or 1, depending on
whether or not the return from ftok() is -1...

Offline

Board footer

Powered by FluxBB