Results 1 to 7 of 7

Thread: qnetworkaccessmanager problem!

  1. #1
    Join Date
    Jul 2009
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default qnetworkaccessmanager problem!

    hi to all. this is my first post in qtcentre, and basically my first question ever related to QT!
    i'am trying to send audio data captured from mic to an ip camera (it has a build-in speaker).
    the http api of my camera expects A POST HTTP request of the form:

    POST /axis-cgi/audio/transmit.cgi HTTP/1.0\r\n
    Content-Type: audio/basic\r\n
    Content-Length: 9999999\r\n
    Connection: Keep-Alive\r\n
    Cache-Control: no-cache\r\n
    \r\n
    <Audio data>
    <Audio data>
    <Audio data>
    ...
    <Audio data>


    where <Audio data> are 240 bytes of audio data.


    the problem iam facing is that at the time of the request the audio data are not avaliable. they become avaliable with time as you speak.

    is there a way to handle this situation? how can i post the newly avaliable audio data when they will be avaliable; i guess that for every 240 new bytes of data i could write something like:
    Qt Code:
    1. QNetworkRequest request(url);
    2. request.setRawHeader("httptype","singlepart");
    3. request.setRawHeader("Content-Type","audio/basic");
    4. request.setRawHeader("Connection","keep-alive");
    5.  
    6. //data is a QByteArray of 240 bytes
    7. //and manager is a QNetworkAccessManager object
    8. manager->post(request,&data);
    To copy to clipboard, switch view to plain text mode 

    but what i would like to do is to make the request once and then keep sending the new data when they would be avaliable.
    Does anybody knows how to achieve this with QT;
    any suggestions?

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

    Default Re: qnetworkaccessmanager problem!

    I'd do it manually using QTcpSocket. Your usecase is very simple so you don't have to implement the full http protocol, just mimic it in the parts you need.
    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.


  3. #3
    Join Date
    Jul 2009
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: qnetworkaccessmanager problem!

    the problem is solved. i use my own tcp socket and handle authentication issues myself. But i really wondering why QNetworkAccessManager or QHttp does not allowed access to their internal tcpSocket...Thanks wysota.

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

    Default Re: qnetworkaccessmanager problem!

    QHttp has a QHttp::setSocket() method you can use to access the socket. But I really don't see how it would help in your 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.


  5. #5
    Join Date
    Jul 2009
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: qnetworkaccessmanager problem!

    well QHttp::setSocket() was the first thing i tried without positive results...

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

    Default Re: qnetworkaccessmanager problem!

    But what would you want to do with the socket?
    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.


  7. #7
    Join Date
    Jun 2010
    Posts
    3
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: qnetworkaccessmanager problem!

    I am looking for access to the socket to see if it is still connected or not.

    When I use QNetworkAccessManager and disconnect from the network in the midst of an FTP upload, then QNetworkAccessManager never recovers and never informs me of a problem and subsequent put() requests are ignored.

Similar Threads

  1. Replies: 1
    Last Post: 23rd April 2009, 09:05
  2. Replies: 19
    Last Post: 3rd April 2009, 23:17
  3. Grid Layout Problem
    By Seema Rao in forum Qt Programming
    Replies: 2
    Last Post: 4th May 2006, 12:45
  4. Problem with receiving events from QDateEdit
    By gunhelstr in forum Qt Programming
    Replies: 4
    Last Post: 20th April 2006, 11:21
  5. fftw problem
    By lordy in forum General Programming
    Replies: 1
    Last Post: 16th March 2006, 21:36

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.