Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    QUdpSocket::writeDatagram and connected UDP sockets

    General and Desktop
    1
    1
    1966
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • C
      Chromatix last edited by

      Hi there again,

      The documentation for "QUdpSocket::writeDatagram":http://qt-project.org/doc/qt-5.0/qtnetwork/qudpsocket.html#writeDatagram says:

      bq. Warning: Calling this function on a connected UDP socket may result in an error and no packet being sent. If you are using a connected socket, use write() to send datagrams.

      but provides no reason or explanation of why and when it results in error.

      Actually I am successfully using writeDatagram with both unconnected and "connected" QUdpSockets (via connectToHost()) on my Qt Windows application that is going to be compiled for other platforms too. And I can't see why this can fail.

      The source code of QNativeSocketEnginePrivate::nativeSendDatagram which does the actual datagram sending also looks very innocent, only able to generate DatagramTooLargeError and the generic NetworkError errors.

      I'm looking for more insight about this, probably from developers themselves. :)

      1 Reply Last reply Reply Quote 0
      • First post
        Last post