If latency is a problem and the default UDP network stack does not work as you wish, try using different existing (installable) network stacks.
For example, try UDP Lite , compare with the standard UDP stack, this particular stack does not perform any checksum in the UDP datagram, thus reducing latency by providing a damaged datagram for the application layer.
Side note: you do not need to have a โpollingโ mechanism. Read the select manual (and its possible derivative, for example pselect or ppoll ), with such an API, the kernel will โwake upโ your application as soon as it has something to read or write in the pipeline.
source share