Sending UDP packets and QUdpSocket::writeDatagram
Here is a snippet of code that I am using send a UDP packet. All works fine as long as the destination IP address is active. If the IP address is not active/reachable I see ARP 'who has a.b.c.d'. With UDP being connectionless I would not expect this behavior. Any comments or suggestions are welcome.
60 4.562357000 DellEsgP_e1:83:f2 Broadcast ARP 42 Who has 192.168.1.119? Tell 192.168.1.123
txSocket = new QUdpSocket(this); //create UDP socket to send to
// Build a packet to send
txPacket.append("This is a test");
//Create the datagram
txDatagram = txPacket.toUtf8(); //convert string to datagram
//Send the datagram
txSocket->writeDatagram(txDatagram.data(), txDatagram.size(), QHostAddress("192.168.1.118"), 1000);
this is the correct behaviour.
ARP means (Address Resolution Protocol); when a destination address couldn’t be resolved by ARP, the UDP packet isn’t sent. In this way the network isn’t full of no-destination packets.
UPD is a connectionless protocol, so if the destination is resolved the packet is sent regardless if there is someone ready to recevie it..
Thanks, for the reminder an layer 2 behavior.