Results 1 to 17 of 17

Thread: QTcpSocket write data with packet loss - Idiot proof sample does not work!

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #14
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QTcpSocket write data with packet loss - Idiot proof sample does not work!

    Quote Originally Posted by jboban View Post
    If I choose SOCKS5 (with modification of my client), I got the content I sent, but in console your program loops with a message "QNativeSocketEngine::write() was not called in QAbstractSocket::ConnectedState" and put CPU load to 100%.
    It might suggest one of the ends disconnects before all the data is written.

    Otherwise, NetworqDebugger connect to my server side and send wrong data, eg. wrong packet size and then only 1 data byte.
    The proxy doesn't modify your data in any way. If it sends incorrect data, it means it has received incorrect data.

    I thought that I'm already doing.
    No. You are sending a blob containing two bytes of serialized integer followed by serialized byte array with data. You're not sending any chunks and you're not encoding the data size properly. You're totally ignoring the fact that size may not fit into 16 bits but you're then serializing all of the data that can be of arbitrary size (e.g. 16GB). I'm assuming you're doing the same thing on the other end -- reading two bytes, interpreting it as blob size and then waiting in a loop for this amount of data to come in. At best it will put your peers out of sync, at worst it will DOS your receiver (if no data ever comes in) and possibly your sender (as you may run out of RAM trying to send a very large chunk of data that is much larger than 64kB).
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  2. The following user says thank you to wysota for this useful post:

    jboban (26th March 2013)

Similar Threads

  1. Replies: 0
    Last Post: 18th August 2011, 04:36
  2. QTcpSocket write():: How many data sends?
    By Daxos in forum Qt Programming
    Replies: 3
    Last Post: 29th July 2010, 10:27
  3. QTcpSocket write() Trasmission Data Design
    By Daxos in forum Qt Programming
    Replies: 4
    Last Post: 15th July 2010, 18:19
  4. Packet handling advice with QTcpSocket?
    By zAAm in forum General Programming
    Replies: 1
    Last Post: 27th April 2010, 15:23
  5. Packet getting fragmented when sending over QTcpSocket
    By arturo182 in forum Qt Programming
    Replies: 14
    Last Post: 5th August 2009, 23:11

Tags for this Thread

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.