From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fc89c,cf7b099c99ee894b X-Google-Attributes: gidfc89c,public X-Google-Thread: 1014db,cf7b099c99ee894b X-Google-Attributes: gid1014db,public X-Google-Thread: f678f,cf7b099c99ee894b X-Google-Attributes: gidf678f,public X-Google-Thread: fee84,cf7b099c99ee894b X-Google-Attributes: gidfee84,public From: Kok Fock Seng Subject: Re: Digital Unix message queue programming problem!! Date: 1997/02/27 Message-ID: <331635BF.C05@silicon.net.my>#1/1 X-Deja-AN: 221795423 References: <33162B5F.437B@silicon.net.my> Organization: Silicon Navigator Sdn Bhd Reply-To: fskok@silicon.net.my Newsgroups: comp.unix.osf.osf1,comp.unix.programmer,comp.unix.osf.misc,comp.lang.c Kok Fock Seng wrote: > > Hi out there, Something extra to at the the previous posting : I tested the same code on Solaris 2.5. It works!! So how do you guys think? > > I am writing a program utilize the message queue (IPC) feature > in Dec Unix. > > The scenario is the queue can be created using msgget(). > I use ipcs to view it. By when I call msgsnd(), it will > block there (no return) if I set the flag to 0. If I > set the flag to IPC_NOWAIT, it will return with errno = 35. > Well, somehow, the data I want to send cannot get thro. > I have check all the manual and man page. No finding. > Is the any system parameters that I need to set? > > TIA. > > Here's my full test code : > > #include > #include > #include > #include > #include > #include > > int nIndexQueueId; /* message queue id for INDEX */ > > extern int errno; > > typedef struct { > long msgtype; /* queue type */ > char msgbuf [ 100 ]; /* contains the data */ > } MSGQ; > > MSGQ m; > > void main () > { > int messageid; > > m.msgtype = 1L ; > strcpy(m.msgbuf,"This is a test msg!") ; > > if (( messageid = msgget ((key_t)(6000L), IPC_CREAT)) == -1 ) > exit (-1); > fprintf(stderr, "[%d]", messageid); > > if ( msgsnd ( messageid, &m, strlen(m.msgbuf)+1, 0) == -1) > fprintf(stderr, "Test Queue got problem!\n err [%d]", errno); > else fprintf(stderr, "Test Queue OK!\n"); > printf(stderr, "[%d]\n", errno) ; > > } > > Regards, > Kok Fock Seng > fskok@silicon.net.my > System Administrator > Silicon Communications.