I would like to use the recvmmsg
call to read multiple UDP messages from ONE single socket at once. I'm reading data from a single multicast group.
When I read TCP data, I usually use poll/select
with a non-blocking socket (and timeout) to be notified when that is ready to be read. I follow this approach as I am aware of the issue of spurious wakeup and potential troubles of having a blocking socket.
As my application must be very quick, if I follow the same approach with recvmmsg
I will introduce an extra system call (poll/select
) that might slow down the execution.
So my two questions are the following:
- With UDP, can I safely read from BLOCKING sockets using
recvmmsg
withoutpoll/select
or do I have to apply the same principle I've used for TCP (non-blocking+poll)? - Suppose I have a huge amount of multicast traffic, would you go for non-blocking socket +
recvmmsg
only (no poll) and burn a lot of CPU?
I am using Linux: CentOS 7 and Oracle Linux.