Results 1 to 9 of 9

Thread: QUdpSocket error

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2007
    Location
    Munich, Bavaria
    Posts
    144
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    1
    Thanked 19 Times in 19 Posts

    Default Re: QUdpSocket error

    What is the return value of writeDatagram and readDatagram?
    In general: you shall take care about return values - they have a meaning.

    Here is the Qt documentation on writeDatagram:
    Datagrams are always written as one block. 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.


    Believe it or not: ip packet loss is part of udp - if you need reliability: use tcp.

  2. #2
    Join Date
    Mar 2007
    Posts
    29
    Thanks
    2

    Default Re: QUdpSocket error

    I take care of return values and they are about 20000 (bytes) on writeDatagram on linux and windows client.
    Server receives that data size only when linux client is running. processPendingDatagram slot is not called when windows client is running becauese readyRead() signal is not emitted (Udp datagram isn't received entirely).

  3. #3
    Join Date
    Oct 2007
    Location
    Munich, Bavaria
    Posts
    144
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    1
    Thanked 19 Times in 19 Posts

    Default Re: QUdpSocket error

    MTU on Ethernet is ~1500 bytes.
    Meaning the IP packets have a max size of 1500 bytes.
    In case you send data bigger than the MTU - you will get fragmentation.

    This is what we see from your ethereal trace.

    UDP doesn't take care about ordering of packet delivery and/or guarantee of delivery.

    This is what we see in your ethereal trace as well.

    As soon as one ip fragment is lost - the whole datagram is gone.

    My advice: try TCP or send the 20000 bytes in chunks of less than 1480 bytes and re-assemble the whole data pack on server side on your own.

    And believe me: not loosing data in the linux-linux setup is pure luck.

Similar Threads

  1. Error compiling psql plugin
    By vieraci in forum Installation and Deployment
    Replies: 4
    Last Post: 7th October 2007, 02:49
  2. qt 4.2.2 install on aix
    By try to remember in forum Installation and Deployment
    Replies: 2
    Last Post: 28th March 2007, 12:19
  3. Qt-x11-commercial-src-4.2.0-snapshot-20060824 error
    By DevObject in forum Installation and Deployment
    Replies: 4
    Last Post: 24th August 2006, 23:31
  4. use qpsql
    By raphaelf in forum Installation and Deployment
    Replies: 34
    Last Post: 22nd August 2006, 12:52
  5. Am I the only one with "make" error ?
    By probine in forum Installation and Deployment
    Replies: 1
    Last Post: 13th February 2006, 12:54

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.