I'm writing a procedure that creates a UDP socket with a piece of hardware. In my code I basically do this:
create the socket()
bind() the socket
sendto () try to setup comm.
recvfrom () receive response
but if this hw is not turned on, then my code just waits indefinity for a response.
I'm trying to us the setitimer to time the sendto out, but its not working. I setup the setitimer and trap the signal but the code never sends a signal.
signal (SIGALRM, function_call);
setitimer (ITIMER_REAL, &itv, (struct itimerval *) 0);
I'm missing something, between sendto & setitimer? Any ideas?