Important: Please read the Qt Code of Conduct -

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 Tell

    txSocket = new QUdpSocket(this); //create UDP socket to send to


    // Build a packet to send
    txPacket.append("This is a test");
    txPacket.append(" ");

    //Create the datagram
    txDatagram = txPacket.toUtf8(); //convert string to datagram

    //Send the datagram

    txSocket->writeDatagram(, txDatagram.size(), QHostAddress(""), 1000);

  • Hi,

    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.


Log in to reply