c - How to set timeout in recvmmsg()? -
i build simple application using c used recvmmsg()
, , fifth parameter passed timeout of type struct timespec
. set timeout 5 seconds, it's not working, gets blocking infinity.
the code following:
struct timespec timeout; timeout.tv_sec = 5; timeout.tv_nsec = 0; result = recvmmsg(fd, datagrams, batch_size, 0, &timeout);
as alternative, use setsockopt
so_rcvtimeo
option set timeout on socket. affect read operations performed on it.
Comments
Post a Comment