Hi,
I am trying to measure the inter arrival time of the packets that I receive in one of my sockets. Basically, I ve got a socket listening for packets and each time a packet arrives I start a timer. Whenever the next packet arrives I stop the timer and store the value. Then I start a new timer until next packet arrives. The code is below.
Now, I compare my values with those I record with Wireshark and they are clearly apart. While Wireshark values show sharp differences now and them my values are mainly steady and do not vary much. So I wonder if the socket buffer is playing me a hard time. In other words, Is it possible that the socketCode:... #define IARRIVAL_DELAY 1 int Crx=0; struct timeval tv_b_iarrival[100][7000],tv_e_iarrival[100][7000]; float AvgIarrival[100][7000]; char log_iarrival_buf[500]; FILE * fd_iarrival; float MaxIarrival=0.0; double SumIarrival=0.0; char filename_iarrival[150]="log_file.dat"; ... ... nrcv=recvfrom(sockfd,buffer,buffersize, 0, (struct sockaddr *)&address,&addrlen ); if (nrcv>0){ if (IARRIVAL_DELAY){ if (Crx==0)start_time(&tv_b_iarrival[pair][Crx]); else { fd_iarrival=fopen(filename_iarrival,"a"); if(fd_iarrival != NULL) { AvgIarrival[pair][Crx-1]=stop_time(&tv_e_iarrival[pair][Crx-1],&tv_b_iarrival[pair][Crx-1]); sprintf(log_iarrival_buf, "%d,%f\n", Crx,AvgIarrival[pair][Crx-1]); fwrite(log_iarrival_buf,strlen(log_iarrival_buf),1,fd_iarrival); fclose(fd_iarrival); } } if (Crx!=0)start_time(&tv_b_iarrival[pair][Crx]); Crx++; } }
buffer deliver the packet at a certain speed that i can not see the real difference in the arrival time? If that is the case, how could i get the values Wireshark is getting?
Thanks



LinkBack URL
About LinkBacks


