View topic - How to reflect a process id from one process to another?

How to reflect a process id from one process to another?

anything that doesn't fit to other groups.

How to reflect a process id from one process to another?

Postby gunjansethi » Thu Oct 14, 2010 7:20 am

Hello..

Can this is possible to send message from one thread to another thread is both the thread are running in different process.

I think this required to creat and attach channel but for this one have to get the Process id (pid) and Channel id (chid).

AS the process id is available in devctl my concern is that how can i get this process id and share it.

And also does it creat any problem as we are going to send Msg to thread by attaching a channel (which is running in say Process_A) to thread running at say Process_B.

Thanks,
Gunjan
gunjansethi
Active Member
 
Posts: 12
Joined: Wed Oct 06, 2010 10:22 am

Postby harish » Thu Oct 14, 2010 7:33 am

Check with name_open and name_attach instead of ConnectAttach and ChannelCreate

Can find more information in QNX Help document with an example in library reference of name_attach() .
harish
New Member
 
Posts: 4
Joined: Fri Feb 19, 2010 6:41 am

Postby gunjansethi » Thu Oct 14, 2010 10:16 am

hii,
Thanks for the quick reply..

After going through the documentation I found i can send message from one process to another by using Pipes.

From the description given by QNX, -->The popen() function executes the command specified by command and creates a pipe between the calling process and the executed command.

My concern is what is meant by command here and what it going to execute.

And what does pipe() function do ?

Thanks
gunjan
gunjansethi
Active Member
 
Posts: 12
Joined: Wed Oct 06, 2010 10:22 am

Postby gunjansethi » Thu Oct 14, 2010 10:20 am

Do someone have example of how to creat ,read and write in Pipes.

It will be good for me.!!

Thanks
Gunjan
gunjansethi
Active Member
 
Posts: 12
Joined: Wed Oct 06, 2010 10:22 am

Postby mario » Thu Oct 14, 2010 11:33 am

gunjansethi wrote:Do someone have example of how to creat ,read and write in Pipes.

It will be good for me.!!

Thanks
Gunjan


http://www.cs.sunysb.edu/~cse533/asgn1/pipes.html
mario
QNX Master
 
Posts: 4132
Joined: Sun Sep 01, 2002 1:04 am

Postby maschoen » Thu Oct 14, 2010 12:03 pm

If you are concerned about portability to Unix like systems then using pipes makes sense. Otherwise, if this is a native QNX application only, then you probably want to learn how to use QNX message passing. That seemed to be the track you were on at the start of this thread. Pipes are built on top of QNX message passing.
maschoen
QNX Master
 
Posts: 2677
Joined: Wed Jun 25, 2003 5:18 pm

Postby Thunderblade » Thu Oct 14, 2010 12:55 pm

Yeah I agree. Don't use pipes if you don't have to. The original idea of sending messages between processes is the way to go. It's not only possible, it's *the* way to do it. Either use name_attach / name_open, or use resmgr_attach. Or, use a master process that creates child processes which the communicate. The master process can pass the process ID and channel ID to the other processes. I think this is even described in QNX Training material.

Thread creator, I recommend to you to attend a QNX training. It really helps!
Thunderblade
Senior Member
 
Posts: 489
Joined: Thu Apr 07, 2005 11:52 am


Return to General Programming

Who is online

Users browsing this forum: No registered users and 3 guests