I'm working on a project that requires listening and processing messages from multiple external sources.
My application is written in C and running on a Linux Read Hat 9 machine.
I have successfully connected to one external source, but have a questions on how to connect and listen to more than one source without blocking each other.
Generally, how I connect to a source is like this:
My question is, if I have have 2 hdles and use FD_SET() on rd1, will I be able to detect incoming data from both sources?Code:fd_set rd1; int hdle1 = setup(.....); //setup is a function in an API I'm using FD_ZERO(&rd1); FD_SET(hdle1, &rd1); select(hdle+1, &rd1, NULL, NULL, NULL); //waiting
if so, will it create blocking on one of the sources if no data has been detected from the other source? (waiting on one source while the other one has data)
Thanks in advance for your help! Any input is appreciated!Code:fd_set rd1; int hdle1 = setup(.....); //set up first source int hdle2 = setup(.....); //set up second source FD_ZERO(&rd1); FD_SET(hdle1, &rd1); FD_SET(hdle2, &rd1); select(hdle+2, &rd1, NULL, NULL, NULL); //waiting