how to find data received is sent using Send or through Prox

hi,
my application is receiving data from couple of other applications. this
data is send to my application either through Send() or through proxy. now i
need to detach the proxy send by other application after my application
receives it.
but how to find that the data received by my application using Receive ()
function is sent by other application using Send () or using proxy?

thanks in advance,

sameer

“QnxNews” <situelectro@vsnl.com> wrote in message
news:a2bdod$s9p$1@inn.qnx.com

hi,
my application is receiving data from couple of other applications. this
data is send to my application either through Send() or through proxy. now
i
need to detach the proxy send by other application after my application
receives it.



but how to find that the data received by my application using Receive ()
function is sent by other application using Send () or using proxy?

When it’s a Send() the Receive() returns the pid of the process that
sent the message. When it’s a proxy Receive() return the id of the proxy
itself.


thanks in advance,

sameer

\

“QnxNews” <situelectro@vsnl.com> wrote in message
news:a2h30c$kbg$1@inn.qnx.com

Mario Charest wrote in message …

“QnxNews” <> situelectro@vsnl.com> > wrote in message
news:a2bdod$s9p$> 1@inn.qnx.com> …

When it’s a Send() the Receive() returns the pid of the process that
sent the message. When it’s a proxy Receive() return the id of the proxy
itself.

hi
Is their any other method through which this can be decided. as after
receiving proxy, the receiving process has to confirm that the pid
received
is of proxy and not of any running process. this it has to every time it
receives any data. so if their is any method of doing this, overhead of
locating every time is reduced.

pid = Receive(…)

// you call that overhead???

if ( pid == -1 ) {
perror ( “problem with receive”)
}
else if ( pid == our_proxy ) {
do_this();
}
else { // if it’s not a proxy
it must be a message
do_that();
}

I guess if you’d be handling 1000 proxies that would required
checking the pid again 1000 proxies. In this perticular case
I don’t know of any way to figure out if it’s a proxy
or messages. All the ways I can thing of will definitely
create more overhead anyway.


thanks in advance ,

sameer

Mario Charest <goto@nothingness.com> wrote:

“QnxNews” <> situelectro@vsnl.com> > wrote in message
news:a2h30c$kbg$> 1@inn.qnx.com> …

Is their any other method through which this can be decided. as after
receiving proxy, the receiving process has to confirm that the pid
received
is of proxy and not of any running process. this it has to every time it
receives any data. so if their is any method of doing this, overhead of
locating every time is reduced.

pid = Receive(…)

// you call that overhead???

if ( pid == -1 ) {
perror ( “problem with receive”)
}
else if ( pid == our_proxy ) {
do_this();
}
else { // if it’s not a proxy
it must be a message
do_that();
}

I guess if you’d be handling 1000 proxies that would required
checking the pid again 1000 proxies. In this perticular case
I don’t know of any way to figure out if it’s a proxy
or messages. All the ways I can thing of will definitely
create more overhead anyway.

Unless you can’t trust sending processes, this can be done easily by
using different message types (or some other data patterns) for proxy
messages and for process messages.


Wojtek Lerch QNX Software Systems Ltd.

How much overhead does qnx_psinfo create? I’ve never used it, but it can
give you information such as Proxy vs. Process.

Also, is it safe to Reply() to a proxy?

-Ron

“Mario Charest” <goto@nothingness.com> wrote in message
news:a2h82e$nol$1@inn.qnx.com

“QnxNews” <> situelectro@vsnl.com> > wrote in message
news:a2h30c$kbg$> 1@inn.qnx.com> …

Mario Charest wrote in message …

“QnxNews” <> situelectro@vsnl.com> > wrote in message
news:a2bdod$s9p$> 1@inn.qnx.com> …

When it’s a Send() the Receive() returns the pid of the process that
sent the message. When it’s a proxy Receive() return the id of the
proxy
itself.

hi
Is their any other method through which this can be decided. as after
receiving proxy, the receiving process has to confirm that the pid
received
is of proxy and not of any running process. this it has to every time it
receives any data. so if their is any method of doing this, overhead of
locating every time is reduced.

pid = Receive(…)

// you call that overhead???

if ( pid == -1 ) {
perror ( “problem with receive”)
}
else if ( pid == our_proxy ) {
do_this();
}
else { // if it’s not a
proxy
it must be a message
do_that();
}

I guess if you’d be handling 1000 proxies that would required
checking the pid again 1000 proxies. In this perticular case
I don’t know of any way to figure out if it’s a proxy
or messages. All the ways I can thing of will definitely
create more overhead anyway.



thanks in advance ,

sameer

\

This compare is a single machine instruction comparing a single int. You
can’t get any more efficient than that.


Bill Caroselli – 1(626) 824-7983
Q-TPS Consulting
QTPS@EarthLink.net


“Mario Charest” <goto@nothingness.com> wrote in message
news:a2h82e$nol$1@inn.qnx.com

“QnxNews” <> situelectro@vsnl.com> > wrote in message
news:a2h30c$kbg$> 1@inn.qnx.com> …

Mario Charest wrote in message …

“QnxNews” <> situelectro@vsnl.com> > wrote in message
news:a2bdod$s9p$> 1@inn.qnx.com> …

When it’s a Send() the Receive() returns the pid of the process that
sent the message. When it’s a proxy Receive() return the id of the
proxy
itself.

hi
Is their any other method through which this can be decided. as after
receiving proxy, the receiving process has to confirm that the pid
received
is of proxy and not of any running process. this it has to every time it
receives any data. so if their is any method of doing this, overhead of
locating every time is reduced.

pid = Receive(…)

// you call that overhead???

if ( pid == -1 ) {
perror ( “problem with receive”)
}
else if ( pid == our_proxy ) {
do_this();
}
else { // if it’s not a
proxy
it must be a message
do_that();
}

I guess if you’d be handling 1000 proxies that would required
checking the pid again 1000 proxies. In this perticular case
I don’t know of any way to figure out if it’s a proxy
or messages. All the ways I can thing of will definitely
create more overhead anyway.



thanks in advance ,

sameer

\

It is harmless to reply to a proxy. But why would you?

I assume you would get an error. I haven’t actually tried this. But it
won’t cause any harm.


Bill Caroselli – 1(626) 824-7983
Q-TPS Consulting
QTPS@EarthLink.net


“Ron Cococcia” <cococr@cs.rpi.edu> wrote in message
news:a2hjb6$2as$1@inn.qnx.com

How much overhead does qnx_psinfo create? I’ve never used it, but it can
give you information such as Proxy vs. Process.

Also, is it safe to Reply() to a proxy?

-Ron

“Mario Charest” <> goto@nothingness.com> > wrote in message
news:a2h82e$nol$> 1@inn.qnx.com> …

“QnxNews” <> situelectro@vsnl.com> > wrote in message
news:a2h30c$kbg$> 1@inn.qnx.com> …

Mario Charest wrote in message …

“QnxNews” <> situelectro@vsnl.com> > wrote in message
news:a2bdod$s9p$> 1@inn.qnx.com> …

When it’s a Send() the Receive() returns the pid of the process that
sent the message. When it’s a proxy Receive() return the id of the
proxy
itself.

hi
Is their any other method through which this can be decided. as
after
receiving proxy, the receiving process has to confirm that the pid
received
is of proxy and not of any running process. this it has to every time
it
receives any data. so if their is any method of doing this, overhead
of
locating every time is reduced.

pid = Receive(…)

// you call that overhead???

if ( pid == -1 ) {
perror ( “problem with receive”)
}
else if ( pid == our_proxy ) {
do_this();
}
else { // if it’s not a
proxy
it must be a message
do_that();
}

I guess if you’d be handling 1000 proxies that would required
checking the pid again 1000 proxies. In this perticular case
I don’t know of any way to figure out if it’s a proxy
or messages. All the ways I can thing of will definitely
create more overhead anyway.



thanks in advance ,

sameer



\

“Wojtek Lerch” <wojtek_l@ottawa.com> wrote in message
news:a2hfp3$b9e$1@nntp.qnx.com

Mario Charest <> goto@nothingness.com> > wrote:
“QnxNews” <> situelectro@vsnl.com> > wrote in message
news:a2h30c$kbg$> 1@inn.qnx.com> …

Is their any other method through which this can be decided. as after
receiving proxy, the receiving process has to confirm that the pid
received
is of proxy and not of any running process. this it has to every time
it
receives any data. so if their is any method of doing this, overhead of
locating every time is reduced.

pid = Receive(…)

// you call that overhead???

if ( pid == -1 ) {
perror ( “problem with receive”)
}
else if ( pid == our_proxy ) {
do_this();
}
else { // if it’s not a
proxy
it must be a message
do_that();
}

I guess if you’d be handling 1000 proxies that would required
checking the pid again 1000 proxies. In this perticular case
I don’t know of any way to figure out if it’s a proxy
or messages. All the ways I can thing of will definitely
create more overhead anyway.

Unless you can’t trust sending processes, this can be done easily by
using different message types (or some other data patterns) for proxy
messages and for process messages.

Good idea, proxies could have a specific messase payload that would
be different from all possible messages.


Wojtek Lerch QNX Software Systems Ltd.

Mario Charest wrote in message …

“QnxNews” <> situelectro@vsnl.com> > wrote in message
news:a2bdod$s9p$> 1@inn.qnx.com> …

When it’s a Send() the Receive() returns the pid of the process that
sent the message. When it’s a proxy Receive() return the id of the proxy
itself.

hi

Is their any other method through which this can be decided. as after
receiving proxy, the receiving process has to confirm that the pid received
is of proxy and not of any running process. this it has to every time it
receives any data. so if their is any method of doing this, overhead of
locating every time is reduced.

thanks in advance ,

sameer

QnxNews <situelectro@vsnl.com> wrote:

hi,
my application is receiving data from couple of other applications. this
data is send to my application either through Send() or through proxy. now i
need to detach the proxy send by other application after my application
receives it.
but how to find that the data received by my application using Receive ()
function is sent by other application using Send () or using proxy?

Hm… this sounds like you are doing something which is not recommended.

Proxies are NOT intended as a data-carrying method, but as a signalling
method. You should not be attaching proxies to another process.

That is, when you call qnx_proxy_attach(), the first parameter (pid)
should always be passed as 0, meaning attach the proxy to my process.

Then, if someone else is to trigger it, you pass this proxy id to that
process so that they can notify you that something happened.

If you need to move data, you should use a Send/Receive/Reply.

Use qnx_proxy_attach(someone_else, data, sizeof(data)); Trigger(proxy);
to send data is both incredibly in-effecient, will NOT work accross
the netowrk, and causes the architectural/design problem that you’ve
just encountered.

If you need to move data in a non-blocking manner, a better architecture
to look at is inverting the S/R/R direction, and moving the data with
a Reply().

That is, A wants to move data to B, but not end up Send/Reply blocked.
A triggers a proxy B has setup, B Sends to A with a “get data” message,
A Replies with the data. B has not made a blocking call.

-David

QNX Training Services
I do not answer technical questions by email.

Ron Cococcia <cococr@cs.rpi.edu> wrote:

How much overhead does qnx_psinfo create? I’ve never used it, but it can
give you information such as Proxy vs. Process.

qnx_psinfo() is a S/R/R interaction with Proc.

Also, is it safe to Reply() to a proxy?

Yes, it is safe. Reply() will fail (return -1) errno will probably
be ESRCH.

-David


QNX Training Services
I do not answer technical questions by email.