TCP/IP and Receive()

Hi There,

Can anyone point me in the right direction here?

I want to receive standard QNX messages using the Receive() call and also
unblock on the Receive() when data arrives at a TCP socket (for which you
would normally call recv()).
qnx_proxy_attach and dev_arm don’t seem to work with the socket fd, so can
anyone tell me if it can be done and how it is done?

Thanks in advance.

I’m not authoritative on this subject, but perhaps I can “point you in the
right direction”: check out the documentation of the select() call. It
refers to an internal function called select_receive() which might help.
(It involves using proxies.)

Another way is to fork a dedicated child process which does a dedicated
recv() on the TCP socket and sends the received data to it’s parent. (On
other systems one might use a thread for this purpose, but threads aren’t
very well supported on QNX4.)

I think there are other ways using (undocumented) QNX4 internals which
I’ll leave to the gurus to comment on.

Good luck.

regards,
rick

John Christini <john@a.com> wrote:

Hi There,

Can anyone point me in the right direction here?

I want to receive standard QNX messages using the Receive() call and also
unblock on the Receive() when data arrives at a TCP socket (for which you
would normally call recv()).
qnx_proxy_attach and dev_arm don’t seem to work with the socket fd, so can
anyone tell me if it can be done and how it is done?

Thanks in advance.

John Christini <john@a.com> wrote:

Hi There,

Can anyone point me in the right direction here?

I want to receive standard QNX messages using the Receive() call and also
unblock on the Receive() when data arrives at a TCP socket (for which you
would normally call recv()).
qnx_proxy_attach and dev_arm don’t seem to work with the socket fd, so can
anyone tell me if it can be done and how it is done?

My preferred method is to use asynchronous I/O with the socket. There is
a (standard) socket option that says to deliver a SIGIO to your process
whenever there is activity on the socket. Set that. Attach a signal
handler for SIGIO, and in there Trigger a proxy to yourself. Since
signals are a pain to handle, unmask the SIGIO before calling Receive,
mask it again after. If you get interrupted by a signal, just call
Receive again. If you get unblock by the proxy, call Select() to determine
which fd(s) need attention. If you get unblocked by some other proxy,
or a message, handle it appropriately.

-David

David Gibbs
QNX Training Services
dagibbs@qnx.com

Thanks Rick.

“Rick Lake” <rick@private-domain.nl> wrote in message
news:deuvd2$lj6$1@inn.qnx.com

I’m not authoritative on this subject, but perhaps I can “point you in the
right direction”: check out the documentation of the select() call. It
refers to an internal function called select_receive() which might help.
(It involves using proxies.)

Another way is to fork a dedicated child process which does a dedicated
recv() on the TCP socket and sends the received data to it’s parent. (On
other systems one might use a thread for this purpose, but threads aren’t
very well supported on QNX4.)

I think there are other ways using (undocumented) QNX4 internals which
I’ll leave to the gurus to comment on.

Good luck.

regards,
rick

John Christini <> john@a.com> > wrote:
Hi There,

Can anyone point me in the right direction here?

I want to receive standard QNX messages using the Receive() call and also
unblock on the Receive() when data arrives at a TCP socket (for which you
would normally call recv()).
qnx_proxy_attach and dev_arm don’t seem to work with the socket fd, so
can
anyone tell me if it can be done and how it is done?

Thanks in advance.

Thanks David.

“David Gibbs” <dagibbs@qnx.com> wrote in message
news:devkq2$avr$1@inn.qnx.com

John Christini <> john@a.com> > wrote:
Hi There,

Can anyone point me in the right direction here?

I want to receive standard QNX messages using the Receive() call and also
unblock on the Receive() when data arrives at a TCP socket (for which you
would normally call recv()).
qnx_proxy_attach and dev_arm don’t seem to work with the socket fd, so
can
anyone tell me if it can be done and how it is done?

My preferred method is to use asynchronous I/O with the socket. There is
a (standard) socket option that says to deliver a SIGIO to your process
whenever there is activity on the socket. Set that. Attach a signal
handler for SIGIO, and in there Trigger a proxy to yourself. Since
signals are a pain to handle, unmask the SIGIO before calling Receive,
mask it again after. If you get interrupted by a signal, just call
Receive again. If you get unblock by the proxy, call Select() to
determine
which fd(s) need attention. If you get unblocked by some other proxy,
or a message, handle it appropriately.

-David

David Gibbs
QNX Training Services
dagibbs@qnx.com