Rawsocket sendto () part of the packet is discarded and not displayed on the network

socketFd_ = socket(AF_INET, SOCK_RAW, protoType);    
sentBytes = sendto(socketFd_, buf, len, 0, 
                  (struct sockaddr   *)&sa,sizeof(structsockaddr_in));
protoType = GRE

I send 1000 packets on the network. If my baud rate tx is 40, I can see the whole packet in wirehark. however, when I try to send at a speed of 100, some of the packets (3-4) will not be available on the network, however sendto will not return any errors. I know that sendto just puts txpacket in the queue and does not guarantee delivery of the packet on the network, but where can I get the statistics of packet packets and the reason for the packet to crash in the kernel. I tried to increase the txqueuelen interface to 65000, but that did not help. how can i debug this problem?

+3
source share
1 answer

You are correct that sendto will simply queue txpacket and do not guarantee delivery.

iEEE sendto:

sendto() . -1 .

ioctl() getsockopt(), . , , .

- :

sendMsgThrottled( msg Msg ) {
    ioctl(socketFd_, SIOCOUTQ, &outstandingBytes);  
    if ( outStandingBytes < limit )
          sendto(socketFd_, ..)
    else
          queueMsg();  /* Or delay */
}

, , , .

+1

All Articles