Project Home
Project Home
Trackers
Trackers
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - How to setup a server waiting for multiple inputs?: (3 Items)
   
How to setup a server waiting for multiple inputs?  
Hi all,

I'm trying to code-up a process to wait for input from any one of multiple sources under Neutrino.  Some sources will be
 POSIX sockets (if all sources were 'sockets', the answer to my question would be 'use "select"') while others use QNX 
intrinsic messages (if all sources were QNX messages, the answer might be 'use MsgReceive').  In addition, I need to be 
able to timeout my wait.  How do I do all of that?

I've looked through the online, in the Foundry, in various documents (including "QNX Neutrino Resource Managers: Using 
MsgSend() and MsgReply()" and "Writing a Resource Manager"), and in "QNX Neutrino 2, A Guid for Realtime Programmers".  
I'm thinking that my solution might involve 'ionotify'.  I haven't, yet, but I'm thinking I'll check out the 'select' 
source code.

Thanks!
Re: How to setup a server waiting for multiple inputs?  
Wade Guthrie wrote:
>  Hi all,
>
>  I'm trying to code-up a process to wait for input from any one of
>  multiple sources under Neutrino.  Some sources will be POSIX sockets
>  (if all sources were 'sockets', the answer to my question would be
>  'use "select"') while others use QNX intrinsic messages (if all
>  sources were QNX messages, the answer might be 'use MsgReceive').  In
>  addition, I need to be able to timeout my wait.  How do I do all of
>  that?
 >
>  I've looked through the online, in the Foundry, in various documents
>  (including "QNX Neutrino Resource Managers: Using MsgSend() and
>  MsgReply()" and "Writing a Resource Manager"), and in "QNX Neutrino
>  2, A Guid for Realtime Programmers".  I'm thinking that my solution
>  might involve 'ionotify'.  I haven't, yet, but I'm thinking I'll
>  check out the 'select' source code.

Yup, io-notify is your best bet.  The way that select works is that it 
talks to
each server it has an fd for and registers a sigevent to deliver a 
thread-targetted
signal (so that a new channel doesn't have to be created, if you have a 
channel
hanging around then you could use pulses).

If no server has any data, then the client does a timed wait for that 
signal (to
provide the timeout functionality).

If the servers you are talking to use QNX Messages then they can provide
the ionotify behaviour pretty easily by doing a bit of book keeping.

Hope this helps,
 Thomas
Re: How to setup a server waiting for multiple inputs?  
Thanks!