Important: Please read the Qt Code of Conduct -

Transferring file over QUdpSocket

  • Hi,
    myself trying to send an image file using QUdpSocket. I need to know what is the maximum size of data that qudpsocket can send.

  • From the "Documentation:":

    The maximum size of a datagram is highly platform-dependent, but can be as low as 8192 bytes. If the datagram is too large, this function will return -1 and error() will return DatagramTooLargeError.
    Sending datagrams larger than 512 bytes is in general disadvised, as even if they are sent successfully, they are likely to be fragmented by the IP layer before arriving at their final destination.

    Total size of all the packets is not limited as far as I know.

  • Lifetime Qt Champion


    If I may, using UDP to send file is generally not a good idea, you have no guarantee to get all data over that protocol. You should rather use the QTcpXXX classes

Log in to reply