Results 1 to 10 of 10

Thread: QT cannot read continuation or non-http traffic

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2009
    Posts
    13
    Qt products
    Qt4
    Platforms
    Windows

    Thumbs up Re: QT cannot read continuation or non-http traffic

    You are right. Arg. QHTTP::abort also kills the TCP connection. So much for their documentation:

    QHttp does not take ownership of the socket, and will not delete socket when destroyed.
    The good news is I was able to use QTcpSocket::read() and bytesAvailable() without deleting the QHttp object. I'm getting my data now!!

    Thank-you very much for your help!

  2. #2
    Join Date
    May 2009
    Posts
    13
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QT cannot read continuation or non-http traffic

    Alas, I thought I had this problem solved. Using the QTcpSocket::read() worked when I sent data that was the character pattern 0 to 9,a to z, but when I connected the AXIS serial port to the device that feeds it serial data, something in the serial data makes QT think there is a valid HTTP header and it created to new request (very strange). The output below is from slots connnected to the various QHttp signals.

    It is very strange that QT creates a Id=0 request. Why does it do that?

    Opened file serialCapture.txt
    requestStarted: request type setHost rx : id = 1 (id = 1)
    requestFinished: request setHost rx : id = 1, ID = 1, error = No error
    requestStarted: request type setSocket rx : id = 3 (id = 3)
    requestFinished: request setSocket rx : id = 3, ID = 3, error = No error
    requestStarted: request type GET rx connect : id = 4 (id = 4)
    stateChanged: request type GET rx connect : id = 4 Id=4 is changed to Sending
    stateChanged: ---reading state---
    stateChanged: request type GET rx connect : id = 4 Id=4 is changed to Reading
    readResponseHeader: code = 204 for Id = 4
    stateChanged: request type GET rx connect : id = 4 Id=4 is changed to Connected
    requestFinished: request GET rx connect : id = 4, ID = 4, error = No error
    done: No Error.
    ******I start sending my canned serial data here (which comes as HTTP continuation of data packets)**************
    stateChanged: ---reading state---
    stateChanged: request type Id=0 is changed to Reading
    readData: has read 1 packets of 51 bytes
    readData: has read 5 packets of 3807 bytes
    Closing stream capture file
    readData: has read 9 packets of 7524 bytes
    readData: has read 13 packets of 11256 bytes
    readData: has read 17 packets of 14990 bytes
    readData: has read 21 packets of 16868 bytes
    ******The device starts sending serial data here(which comes as HTTP continuation of data packets)**************

    stateChanged: request type Id=0 is changed to Closing
    stateChanged: request type Id=0 is changed to Unconnected
    *****At this point the TCP connection is closed by QHttp. Arg!********
    It looks like I have to write my own HTTP handler. Darn.

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: QT cannot read continuation or non-http traffic

    You're doing something very non-standard so I wouldn't rely on QHttp behaving in a sane way in such situation.
    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.


Similar Threads

  1. HTTP GET authentication does not proceed
    By SailingDreams in forum Qt Programming
    Replies: 2
    Last Post: 1st June 2009, 01:27
  2. QIODevice read()
    By ShaChris23 in forum Newbie
    Replies: 1
    Last Post: 3rd May 2007, 00:29

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.