I want to have a timeout on a recvfrom call. I tried using the TimerTimeout
function - it does not seem to have worked.
Will TimerTimeout work with the recvfrom call?
tTO_Event.sigev_notify = SIGEV_UNBLOCK;
ui64Timeout = 5LL * NSEC_PER_SEC;
TimerTimeout( CLOCK_REALTIME,
_NTO_TIMEOUT_SEND | _NTO_TIMEOUT_REPLY,
&tTO_Event, &ui64Timeout, NULL );
iRecvBytes = recvfrom ( sd, TempBuffer, sizeof(TempBuffer), 0, (struct
sockaddr *) &cliAddr, &cliLen );
iSaved_errno = errno;
Regards
Mike Nunan
Michael Nunan wrote:
I want to have a timeout on a recvfrom call. I tried using the TimerTimeout
function - it does not seem to have worked.
Will TimerTimeout work with the recvfrom call?
tTO_Event.sigev_notify = SIGEV_UNBLOCK;
ui64Timeout = 5LL * NSEC_PER_SEC;
TimerTimeout( CLOCK_REALTIME,
_NTO_TIMEOUT_SEND | _NTO_TIMEOUT_REPLY,
&tTO_Event, &ui64Timeout, NULL );
iRecvBytes = recvfrom ( sd, TempBuffer, sizeof(TempBuffer), 0, (struct
sockaddr *) &cliAddr, &cliLen );
iSaved_errno = errno;
TimerTimeout will definately work with recvfrom (recvfrom is just a
cover for MsgSendv); but have you looked at the SO_SNDTIMEO, and
SO_RCVTIMEO socket options ? (these may be more appropriate as they are
a little less “harsh”).
I think your problem might be that you aren’t using the provided macro
to set the event structure.
Rennie
I think you need to use setsockopt() function… or ioctl()…
Michael Nunan wrote:
I want to have a timeout on a recvfrom call. I tried using the TimerTimeout
function - it does not seem to have worked.
Will TimerTimeout work with the recvfrom call?
tTO_Event.sigev_notify = SIGEV_UNBLOCK;
ui64Timeout = 5LL * NSEC_PER_SEC;
TimerTimeout( CLOCK_REALTIME,
_NTO_TIMEOUT_SEND | _NTO_TIMEOUT_REPLY,
&tTO_Event, &ui64Timeout, NULL );
iRecvBytes = recvfrom ( sd, TempBuffer, sizeof(TempBuffer), 0, (struct
sockaddr *) &cliAddr, &cliLen );
iSaved_errno = errno;
Regards
Mike Nunan
\
–
Cláudio Cardozo
cazo@infax.com.br, cazo@bol.com.br