How can I drop a UDP (SOCK_DGRAM) packet if it is taken too long to return (from an echo server)? Also, I need it to be reported as lost.
Here's the socket code I can give:
the counters don't seem to be working (all of this is in a while loop.) I'm using a linux machine. I want to drop any packets that don't match the ones sent by the client (and report that they were dropped).
Here's the socket code I can give:
1 if ( sendto( dsock, // local socket 2 buffer, msglen, // message 3 0, // Flags 4 ( sockaddr * ) &saddr, // destination address 5 sizeof(saddr) // length of destination address 6 ) 7 < msglen ) { 8 errorExit( "Error sending to server" ); 9 } else { 10 sendCount++; //supposed to count sent packets 11 } 12 13 msglen = recvfrom( dsock, // local socket 14 buffer, buflen, // message buffer, length 15 0, // flags 16 NULL, 0 // sockaddr, length 17 ); 18 if ( msglen < 0 && errno != EAGAIN ) { 19 errorExit( " Failed to recv from data socket" ); 20 } else { 21 recvCount++; //supposed to count received packets 22 }
the counters don't seem to be working (all of this is in a while loop.) I'm using a linux machine. I want to drop any packets that don't match the ones sent by the client (and report that they were dropped).
