This is actually a good point. In my case I am receiving RTP packet on my socket and they are normally around 20ms apart and although i have changed the code as you mentioned
Opening and closing a file takes 1 second (doesn't matter, it's just "large")
The variation between message arrival times is anything from 1mS to 10mS.
the outcome is still the same.
only write it out when the array is full
I havent been completely transparent in the code, but actually these variables are global variables
How can you have multiple threads, when you have a single scalar variable for your subscripts?
struct timeval tv_b_iarrival,tv_e_iarrival;
So I can have up to 100 threads but all write in the same array, so that then the main threat can handle all the data.
I simply want to measure the inter arrival time of the packets nothing but that, i am not seting an event out of it.
Is it really a timer, that will fire some event at a future time?
So, my main questions whether the socket's buffer can smooth the real arrival time with sockets is still unfolded.