Hi I'm trying to implement a timeout for my class, but I can't find a really good example to base it off, can anyone point me to one?
I want to be able to start a timer at a send and should it hit 5 secs I want to resend until i get an acknowledge from where I am sending to. thanks.
I'm assuming you are using sockets (from the send comment).
What you need is something like this:
send(...); /* send the data */
int ret = select(...); /* use select to figure out when a response has been received. Set select timeout to 5 seconds. */
if(ret == 0)
/* select timed out, so no response was received within 5 seconds. */
else if(ret > 0)
/* Got something back */