Results 1 to 3 of 3

Thread: Sample of Http server

  1. #1
    Join Date
    Jan 2006
    Posts
    122
    Thanks
    16
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Sample of Http server

    Hi,
    I'm looking for a sample of an http server written in QT that has just to receive a POST with a JPG image and send back another JPG image.
    At the moment I set up a QTcpServer that can accept the connection

    Qt Code:
    1. QTcpSocket *clientConnection = tcpServer->nextPendingConnection();
    2. connect(clientConnection, SIGNAL(disconnected()),
    3. clientConnection, SLOT(deleteLater()));
    4.  
    5. clientConnection->waitForReadyRead(2000);
    6. qint64 byteAvail = clientConnection->bytesAvailable();
    To copy to clipboard, switch view to plain text mode 

    And I see I'm getting there are bytes available to read,
    so my questions:

    - Is there some sample aroung a bout implementing an HTTP Server ?
    - How can I get the data and unwrap the HTTP packet, just when I know I received all?

    Thanks a lot in advance
    Bye

  2. #2
    Join Date
    Jan 2006
    Posts
    122
    Thanks
    16
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Sample of Http server

    There's really no way to parse a HTTP POST request retrieving the jpg image?
    Thanks

  3. #3
    Join Date
    Aug 2010
    Posts
    3
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Maemo/MeeGo

    Default Re: Sample of Http server

    I wrote a LOOOOONG post about this explaining a lot of things but I lost the session and I posted LOOSING all the post , so the short answer is

    QTcpSocket* socket = (QTcpSocket*)sender();
    QString text;
    while(socket->bytesAvailable() || socket->canReadLine())
    {
    text += socket->readLine();
    }

Similar Threads

  1. Replies: 3
    Last Post: 29th November 2009, 20:24
  2. A simple HTTP server going wrong.
    By spraff in forum Qt Programming
    Replies: 1
    Last Post: 12th November 2008, 20:09
  3. Build an HTTP server
    By the_bis in forum Qt Programming
    Replies: 4
    Last Post: 30th March 2007, 07:36
  4. How a server can write "Hello" to a browser ?
    By probine in forum Qt Programming
    Replies: 2
    Last Post: 1st December 2006, 14:43
  5. synching client readings to server output
    By OnionRingOfDoom in forum Qt Programming
    Replies: 14
    Last Post: 28th January 2006, 18:15

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.