Hello network experts,
I have problems debugging my 100MBit/s ethernet communication between a dedicated Intel network card an a microcontroller (MC) board. The MC is directly connected to the pc with a 1 meter ethernet cable. Network card and MC have fixed IPs and the UDP communication works in most cases.
Now I want to send 100000 bytes to the MC and do so by sending UDP packets of about 1000 bytes each.
The pc has wireshark running to see all the packets.
My program always successfully sends all the packets with "sendto" (see the function below). But wireshark only sees all the packets when I introduce a "usleep(100)" between the "sendto" commands. Sending the packets without waiting results in that wireshark just sees the first few packets.
Where are the missing packets?
I know that UDP does not guarantee the packets to arrive, but AFAIK they should at least be sent.
Please help,
Michael
Code:
int send_data( char *buffer, int buf_length )
{
int rc = sendto (sock, buffer, buf_length, 0,
(struct sockaddr *) &pmi_addr,
sizeof(pmi_addr));
if (rc < 0)
{
printf ("could not send data\n");
close (sock);
exit (EXIT_FAILURE);
}
if (rc != buf_length)
{
printf ("could not send whole data block\n");
close (sock);
exit (EXIT_FAILURE);
}
return(0);
}