Results 1 to 2 of 2

Thread: Http server : send images

  1. #1
    Join Date
    Oct 2009
    Posts
    38
    Thanks
    13
    Platforms
    Unix/X11 Windows

    Default Http server : send images

    Hi there!

    I'd like to be able to create a server that can send images (stored in his memory) when a browser asks for it.

    For example, if firefox wants to load this :
    Qt Code:
    1. http://127.0.0.1/tree.png
    To copy to clipboard, switch view to plain text mode 

    I want my server to send the content of the image tree that he has in memory.

    EDIT : I think QTextStream can do what I want, but I don't know how to use it.

    Indeed, when I want to load my image in firefox, it says : "The image [...] cannot be displayed, because it contains errors"

    Any idea
    Last edited by fitzy; 28th October 2009 at 23:57.

  2. #2
    Join Date
    Oct 2009
    Posts
    37
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11

    Default Re: Http server : send images

    You have to send a proper HTTP protocol response. This consists of a HTTP 200 line, the headers, a blank line and then the raw image data. Check the web for the exact format.

    You don't need QTextStream at all.
    Disclaimer: Although I work on Qt for Nokia, anything I post here is personal

Similar Threads

  1. Sample of Http server
    By Lele in forum Qt Programming
    Replies: 2
    Last Post: 1st December 2010, 00:43
  2. Simple Threaded Http Server
    By obi in forum Qt Programming
    Replies: 4
    Last Post: 20th October 2009, 11:42
  3. How do I send data with http post request?
    By Morea in forum Qt Programming
    Replies: 13
    Last Post: 21st January 2009, 23:51
  4. A simple HTTP server going wrong.
    By spraff in forum Qt Programming
    Replies: 1
    Last Post: 12th November 2008, 21:09
  5. Connect to a server, send data and exit
    By Pepe in forum Newbie
    Replies: 6
    Last Post: 27th July 2007, 12: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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.