473,657 Members | 2,896 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Count Messages in Message Queue

Hi,

I have developed an application in C on IBM AIX 5.2. Its using
multiple Message Queues to share data between different processes. I
am using following functions to send/receive messages into/from
message queues:

int msgget(key_t, int);
ssize_t msgrcv(int, void *, size_t, long int, int);
int msgsnd(int, const void *, size_t, int);

Now I want to calculate number of messages in each message queue at a
specific time. So which function should I use? There is a function
named "mq_getattr " to get queue attributes. Can this help out?

Thanks in anticipation.

Regards,

Ahmad Jalil Qarshi
Aug 10 '08 #1
3 5002
On Sun, 10 Aug 2008 16:27:50 -0700 (PDT), Ahmad Jalil Qarshi
<Ah************ ****@gmail.comw rote in comp.lang.c:
Hi,

I have developed an application in C on IBM AIX 5.2. Its using
multiple Message Queues to share data between different processes. I
am using following functions to send/receive messages into/from
message queues:

int msgget(key_t, int);
ssize_t msgrcv(int, void *, size_t, long int, int);
int msgsnd(int, const void *, size_t, int);

Now I want to calculate number of messages in each message queue at a
specific time. So which function should I use? There is a function
named "mq_getattr " to get queue attributes. Can this help out?

Thanks in anticipation.

Regards,

Ahmad Jalil Qarshi
Ahmed,

This is not really the correct place to ask this question. Your
question is not about the C language or standard C library, which are
the topics here. Instead your question is about the use of a
system-specific library, which is not part of the C language itself.

I see a large number of newsgroups dedicated to IBM's AIX, although I
do not know how active any of them are. For example:

news:comp.sys.a ix, news:comp.unix. aix, and several in the family
news:ibm.*.aix.

The people most knowledgeable about AIX and the specific functions you
are trying to use will most likely be found in one of these groups.

I suggest you take a look at these groups, and select one or two to
ask this question.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.l earn.c-c++
http://www.club.cc.cmu.edu/~ajo/docs/FAQ-acllc.html
Aug 11 '08 #2
Jack Klein <ja*******@spam cop.netwrote:
On Sun, 10 Aug 2008 16:27:50 -0700 (PDT), Ahmad Jalil Qarshi
<Ah************ ****@gmail.comw rote in comp.lang.c:
I have developed an application in C on IBM AIX 5.2. Its using
multiple Message Queues to share data between different processes. I
am using following functions to send/receive messages into/from
message queues:

int msgget(key_t, int);
ssize_t msgrcv(int, void *, size_t, long int, int);
int msgsnd(int, const void *, size_t, int);

Now I want to calculate number of messages in each message queue at a
specific time. So which function should I use? There is a function
named "mq_getattr " to get queue attributes. Can this help out?
This is not really the correct place to ask this question. Your
question is not about the C language or standard C library, which are
the topics here. Instead your question is about the use of a
system-specific library, which is not part of the C language itself.
I see a large number of newsgroups dedicated to IBM's AIX, although I
do not know how active any of them are. For example:
news:comp.sys.a ix, news:comp.unix. aix, and several in the family
news:ibm.*.aix.
Since the functions named by Ahmad are all POSIX functions and thus
probably not AIX-specific also e.g. comp.unix.progr ammer would be
a reasonable choice of a group for asking the question.

Regards, Jens
--
\ Jens Thoms Toerring ___ jt@toerring.de
\______________ ____________ http://toerring.de
Aug 11 '08 #3
On 10 Aug 2008 at 23:27, Ahmad Jalil Qarshi wrote:
I have developed an application in C on IBM AIX 5.2. Its using
multiple Message Queues to share data between different processes. I
am using following functions to send/receive messages into/from
message queues:

int msgget(key_t, int);
ssize_t msgrcv(int, void *, size_t, long int, int);
int msgsnd(int, const void *, size_t, int);

Now I want to calculate number of messages in each message queue at a
specific time. So which function should I use? There is a function
named "mq_getattr " to get queue attributes. Can this help out?
No, but there's a function called msgctl() that you can use for that.

int msgctl(int msqid, int cmd, struct msqid_ds *buf);

If you call this function with IPC_STAT as the cmd argument, this will
fill out the struct pointed to by buf with various bits of information
from the kernel struct associated to the message queue. Check the
documentation for your system to find out what this information consists
of, but in particular POSIX guarantees the existence of a buf->msg_qnum
field of type msgqnum_t, which contains the current number of messages
in the queue.

Aug 11 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
5428
by: Matthew Groch | last post by:
Hi all, I've got a server that handles a relatively high number of concurrent transactions (on the magnitude of 1000's per second). Client applications establish socket connections with the server. Data is sent and received over these connections using the asynchronous model. The server is currently in beta testing. Sporadically over the course of the day, I'll observe the thread count on the process (via perfmon) start climbing....
1
1592
by: Reshma Prabhu | last post by:
Hello, Could any one please give me a sample code to count the number of messages in a queue using C# and the .NET environment without using Performance counters. Thanks, Reshma
3
1634
by: Sun | last post by:
If the email server goes down, I won't be able to send messages using SmtpMail. I'll get a "Could not Access CDO.Message ..." error. Is there a way to queue the message so that it can be sent out when the system is back running? When we use Outlook, the message is queued when the system is down and sent out when the system is back up. Thanks!
2
2684
by: Al Wilkerson | last post by:
Does anyone know why smtp messages stay in the queue folder? Every time I send a message using my local smtp server I get no error, but I never receive the message, and the messages just stay in the inetpub\mailroot\queue folder This happens with sending message through my ASP.NET program and just manually entering smtp commands at the command prompt Thanks,
0
1249
by: Manfred Braun | last post by:
Hi All, I have a problem reading queue-messages async. My QueueReader has a Start() and a Stop() method and if my app starts, it calls Start(). The problem is, that there are possibly several hundreds of messages in the queue, which I do not want to have processed by the async messagehandler at startup. So in Start(), I create a new thread, which's method just simply enums the queue-messages . At the end of this thread, I fire an...
2
4613
by: SammyBar | last post by:
Hi all, I'm trying to send a message from ASP.NET to another PC by using MSMQ. I created my ASP.NET project by using Visual Studio 2005 but I initially set the project to be located on the File System. Then I could successfully send, receive and purge the public queries I use to exchange information with the another PC. But when I realized I can not reach the file system created project from a third PC then I recreated the project as...
0
1035
by: TweetyRocks | last post by:
Hi All, I have 2 Dot Net Windows services. The 1st service inserts a message into an MSMQ queue. The second service picks it up from the queue and processes it. It then removes it from the queue after successful processing. The problem is that though the sending service sends only 1 message, the receiving service receives multiple messages in the queue with different message IDs. This behaviour is random, though it generally happens when...
4
3754
by: =?Utf-8?B?am9obmY=?= | last post by:
Trying to get a see windows messages using IMessageFilter interface however it does not seem to get all window messages. Specifically I am looking for the WM_POWERBROADCAST. I override wndproc which shows the msg successfully but nothing shows up when using IMessageFilter. Am i misunderstanding something? Here is sample code: public class MyFilter : IMessageFilter { const int WM_POWERBROADCAST = 0x0218; public bool...
3
5739
by: scriptlearner | last post by:
I am trying to put up a queue (through a logging thread) so that all worker threads can ask it to log messages. However, the problem I am facing is that, well, the logging thread itself is running forever. It does not know when it should exit. Any suggestion? None of the worker threads knows for sure when the logging thread should exit since they don't know what other worker threads are doing. I also try to set a time limit for the...
0
8302
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8820
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8499
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8601
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7314
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6162
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5630
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
1937
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1601
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.