Its a very simple problem which anyone who has worked on any UDP
application might have faced.
UDP by itself is unreliable. If packets are lost, no acknowledgements
I have a UDP application which is receiving packets on a standard port.
It receives packets asynchronously. At any time any packet can arrive.
The problem is that sometimes a number of packets arrive and our UDP
socket buffer ( being of finite size ) is not able
to handle them and simply drops the packet.
The UDP socket buffer cannot be increased beyond a finite size(
dynamically it cannot be increased, it is fixed for an OS) .
So a number of packets simply drop with out any intimation to the
I need to have checkpoint ( some kind of intimation ) that the packets
are being dropped.
I have implemented polling with poll parameter as POLLIN or
POLLRDNORM.( I have tried both parameters)
Both implementation works that is gives me a poll status implying
socket buffer is full.
In my test set up I can control the rate at which packets are
When the packets are sent at a very high rate and my socket buffer is
not able to handle them, polling status tells me that
buffer is full.
when the rate of sending packets is slow, I get an intimation that
buffer space is available.
But in some cases ( when the rate of sending packets is slow ), I get a
poll status that buffer is full ( which is wrong ). Even though
these are corner cases but it made me think.( and caused worry) .
I have following queries..
a) Do we have any mechanism/ way in which we can find that udp socket
buffer is full and packets are being dropped.
b) Can polling be actually be used. My corner cases made me think that.
Is my approach totally wrong.
c) If not Polling then what ?
d) If polling can be used, which other parameters I can use to avoid
these corner case.
e) Is my implementation of polling wrong, Is it possible that I am
misunderstanding the polling status to tell whether
buffer is full.
if you have some idea about this issue please let me know.
If you need some more input from my end let me know.