Hi Gurus,
This is my first thread here.
I m developing p2p multicasting subtrate which is intended to multicast a query string and wait for a response from its groups nodes.
here i need to wait for some time (eg 5 seconds ) for a response after i multicast the message and print the response. how can i implement this? i know this is simple but as im new to C i hv no idea how to do this.
here is my code fragment
Code:
// some code here
if(fork())
{
while(1){
new_mcast_recieve( host ,port );
// todo here how can i wait for 5 seconds for a response. if not exit from the loop
}
}
mcast_send(mc , query , sizeof(query));
//.some code here
if you hv a better structure about how to implemet this please sugest me.
thanks you.