![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Problem with msgget() | Ashwini | High Level Programming | 2 | 09-14-2006 09:13 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
about msgget troble
hi,all
i have in trouble about msgget. i create a queue and the program like blow: openMsg( pid_t key ) { .... int msgid; .... msgid=msgget(key,IPC_CREAT|IPC_EXCL|0666) if( msgid<=0 ){ fprintf( stdout,"%s,%d",strerror(errno),errno ); return -1; } else{ return msgid; } } when i open my computer and run this program first ,the answer always is "Invalid argument" . use ipc to see the queue stat, i found a queue is already exist just like this "Message Queues q 0 0x00000835 --rw-rw-rw- iccard informix " when i delete the queue ,and restart my program ,everything right. so why? please tell me. thank you. Last edited by Perderabo; 03-17-2005 at 08:10 AM. Reason: Remove email |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Hi!
It may be because you are not deleting the "Message Queue" before exiting your application. You should be using the command IPC_RMID in your shmctl() function to remove the Message Queue before exiting your program. Regards SHAIK |
|
#3
|
|||
|
|||
|
yes,but that's not reason
the queue not exist before i run this program.
|
|
#4
|
|||
|
|||
|
What is the value of key ?
|
|
#5
|
|||
|
|||
|
the key is 2101
the key is 2101
|
|
#6
|
|||
|
|||
|
Are you sure you are getting the Error Message "Invalid argument" for this msgget()? Maybe the error is on some other function like: msgctl() or msgsnd() or msgrcv() . . .
|
|
#7
|
|||
|
|||
|
yes i'm sure.
yes, i'm sure.
because i have log file and trace the problem. |
|||
| Google The UNIX and Linux Forums |