From: Kok Fock Seng <fskok@silicon.net.my>
Subject: Re: Digital Unix message queue programming problem!!
Date: 1997/02/27 [thread overview]
Message-ID: <331635BF.C05@silicon.net.my> (raw)
In-Reply-To: 33162B5F.437B@silicon.net.my
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 <termio.h>
> #include <sys/types.h>
> #include <fcntl.h>
> #include <stdio.h>
> #include <sys/ipc.h>
> #include <sys/msg.h>
>
> 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.
next prev parent reply other threads:[~1997-02-27 5:00 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-02-27 5:00 Digital Unix message queue programming problem!! Kok Fock Seng
1997-02-27 5:00 ` Jeremy D. Levine
1997-02-27 5:00 ` Lawrence Kirby
1997-02-28 5:00 ` Andy Knight
1997-02-28 5:00 ` Stephen Baynes
1997-02-27 5:00 ` Kok Fock Seng [this message]
1997-02-27 5:00 ` Charles M Richmond
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox