LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-07-2012, 07:28 AM   #1
Shahid nx
Member
 
Registered: Jan 2012
Posts: 46

Rep: Reputation: Disabled
how to use structure in message Queue in perl ?


Hello Sir/friends,
i have a small problem here that i have written a c++ program which will write a structure of some data into message queue, but i have a task to create and read that from queue in perl script. the problem is i m not getting how to read structure data in perl process because in perl there is no method to define structure .plz if any one know the solution
thanks in advance.

Regards,
SHAHID NX
 
Old 02-07-2012, 07:32 AM   #2
Snark1994
Senior Member
 
Registered: Sep 2010
Location: Wales, UK
Distribution: Arch
Posts: 1,632
Blog Entries: 3

Rep: Reputation: 345Reputation: 345Reputation: 345Reputation: 345
Do you mean you've got to pass data from a C++ programme to a perl programme?

If so, then you could either look into sockets (to communicate directly between the programmes) or just get the C++ programme to write its data to a file, and then have the Perl programme read it from that file.

Hope this helps,
 
1 members found this post helpful.
Old 02-07-2012, 07:44 AM   #3
Shahid nx
Member
 
Registered: Jan 2012
Posts: 46

Original Poster
Rep: Reputation: Disabled
Wink

ya like that we can do but here i m running both c++ and perl process in single server and my sir has suggested to use Message Queue only....

That data is in structure format like struct data{ type1 data1,type2 data2,...};
this structure i can easily write in queue using msgsnd(queueId,$data,sizeof(data),type,flag)function and i can easily read it from queue using msgrcv(queueId,$data,sizeof(data),type,flag) and i can extract each data using its object like obj.data1,obj.data2 etc (just example). . but in perl process there is no concept called structure so if i want to read such kind of data from queue in perl process how can i do that. plz share if you have any idea.

thank you..
 
Old 02-07-2012, 07:52 AM   #4
Snark1994
Senior Member
 
Registered: Sep 2010
Location: Wales, UK
Distribution: Arch
Posts: 1,632
Blog Entries: 3

Rep: Reputation: 345Reputation: 345Reputation: 345Reputation: 345
If I understand you correctly, you want the unpack function. The data you're going to be getting with Perl is just a string of bytes, and you need to tell Perl what data types etc. they are, so it can work out what they mean.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to communicate between two threads using message queue? rosna Programming 4 06-07-2011 09:34 AM
Is it possible for me to write in front of queue in case of message queue? hemanthv414 Linux - Newbie 1 11-17-2008 05:40 PM
Message Queue sarcastodon Programming 0 12-26-2006 11:09 AM
programming for message queue and such ... feetyouwell Programming 0 10-18-2004 05:54 PM
Qmail Message Queue dadepfan Linux - Software 0 07-22-2004 04:54 PM


All times are GMT -5. The time now is 06:37 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration