Help to pass information to another thread needed


I am a newbie programmer in linux domain. I am basically a MicroController programmer familiar with C. Now I am into little PC programing and need some inputs.

I am opening a socket and sending a Broadcast looking for my Embedded device on network. First I am probing the interfaces on the machine and will be broadcasting in each subnet, a call to my device with a signature. The device is listening on that particular port and it responds with its signature. The program then gets the ip and other details of my device and will start communicating. I am sending a call in one function in each interface and to avoid blocking I am creating another listening thread to get response which may take some time to arrive. On receiving response I need to inform other thread about this and data to be given to them. In this scenario, which is the best method to do that? Signal, Message or flag or whatever? Since I need to implement this code in windows also, it will be good if it is possible to use a mechanism which is possible in both platforms. Please suggest
Roy Thomas
Is the writer thread just waiting on some condition (notification from the listener thread)?

You could use a condition for notification. Or you could use non-blocking sockets and multiplex the send/reply in a single thread. Or you could use your Unix's variant of BSD's kqueue and multiplex in a single thread.
Last edited on
Topic archived. No new replies allowed.