Problems with Open-Source Downloads read https://www.qt.io/blog/problem-with-open-source-downloads and https://forum.qt.io/post/638946

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:":http://qt-project.org/doc/qt-4.8/qudpsocket.html#writeDatagram

    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

    Hi,

    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