Results 1 to 11 of 11

Thread: QTcpSocket slowdown

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2008
    Posts
    14
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    1

    Default QTcpSocket slowdown

    I implement an UI application, that handles receiving data from tcp socket in a separate thread.

    I use the following code to read data:
    Qt Code:
    1. data = m_Connection->readAll();
    2. m_CurrentResponse->insert(m_CurrentResponse->size(), data);
    3. while (isResponseFull(m_CurrentResponse))
    4. {
    5. QByteArray* response = new QByteArray(m_CurrentResponse->data(), m_CurrentResponse->size());
    6.  
    7. unsigned int len = // read the 4 bytes to get the length of the responce
    8. response->remove(len, (m_CurrentResponse->size() - len));
    9. m_CurrentResponse->remove(0, len);
    10. processResponse(response);
    11. delete(response);
    12. }
    To copy to clipboard, switch view to plain text mode 
    It crashes at readAll after few minutes. The server sends image data for every 1 ms. The client application should not block while processing data.

    1) Is there any issue in calling readAll when bytesAvailable is more in number?
    2) setReadBufferSize does not help in setting buffer size. Is there any way to restrict to limit receiving data internally in tcpSocket object
    Last edited by wysota; 3rd September 2009 at 08:17. Reason: missing [code] tags

Similar Threads

  1. Challenging QTcpSocket reliability problem
    By Raccoon29 in forum Qt Programming
    Replies: 3
    Last Post: 13th January 2009, 10:38
  2. array of pointers to QtcpSocket
    By gQt in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 16th June 2008, 09:15
  3. QTcpServer & QTcpSocket questions...
    By jxmot in forum Qt Programming
    Replies: 2
    Last Post: 24th April 2008, 21:38
  4. QTcpSocket and libssh2 ...
    By sandros in forum Qt Programming
    Replies: 6
    Last Post: 21st November 2007, 22:34
  5. Strange QTcpSocket behavior (debugged with Ethereal)
    By mdecandia in forum Qt Programming
    Replies: 23
    Last Post: 28th May 2007, 20:44

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.