The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
Google UNIX.COM


High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Problem with msgget() Ashwini High Level Programming 2 09-14-2006 09:13 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 12-27-2001
Registered User
 

Join Date: Dec 2001
Location: GUANGZHOU CHINA
Posts: 11
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
Reply With Quote
Forum Sponsor
  #2  
Old 12-27-2001
shaik786
Guest
 

Posts: n/a
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
Reply With Quote
  #3  
Old 12-27-2001
Registered User
 

Join Date: Dec 2001
Location: GUANGZHOU CHINA
Posts: 11
yes,but that's not reason

the queue not exist before i run this program.
Reply With Quote
  #4  
Old 12-28-2001
shaik786
Guest
 

Posts: n/a
What is the value of key ?
Reply With Quote
  #5  
Old 12-28-2001
Registered User
 

Join Date: Dec 2001
Location: GUANGZHOU CHINA
Posts: 11
the key is 2101

the key is 2101
Reply With Quote
  #6  
Old 12-28-2001
shaik786
Guest
 

Posts: n/a
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() . . .
Reply With Quote
  #7  
Old 12-28-2001
Registered User
 

Join Date: Dec 2001
Location: GUANGZHOU CHINA
Posts: 11
yes i'm sure.

yes, i'm sure.
because i have log file and trace the problem.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 07:28 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0