Results 1 to 5 of 5

Thread: QTcpServer : retrieve the requested URL

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2007
    Location
    Karlsruhe, Germany
    Posts
    469
    Thanks
    17
    Thanked 90 Times in 88 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTcpServer : retrieve the requested URL

    Hi there!

    You need a HTTP-Server for that.

    Have a look at: http://doc.trolltech.com/solutions/4...le-server.html

    HIH

    Johannes

  2. The following user says thank you to JohannesMunk for this useful post:

    fitzy (27th October 2009)

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

    Default Re: QTcpServer : retrieve the requested URL

    Thank you but I can't figure out what is the function that gives the requested address in your example

  4. #3
    Join Date
    Feb 2007
    Location
    Karlsruhe, Germany
    Posts
    469
    Thanks
    17
    Thanked 90 Times in 88 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTcpServer : retrieve the requested URL

    Well.. you need to parse the get command..

    http://en.wikipedia.org/wiki/Hyperte...xample_session

    Qt Code:
    1. QStringList tokens = QString(socket->readLine()).split(QRegExp("[ \r\n][ \r\n]*"));
    2. if (tokens[0] == "GET") {
    To copy to clipboard, switch view to plain text mode 

    tokens[1] should be the requested url.

    Sorry for not having pointed that out .. Maybe you just need to search for a more complete HTTP Server using google?

    Johannes
    Last edited by JohannesMunk; 27th October 2009 at 14:30.

  5. The following user says thank you to JohannesMunk for this useful post:

    fitzy (27th October 2009)

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

    Default Re: QTcpServer : retrieve the requested URL

    Perfect !
    Thank you very much !

Similar Threads

  1. QTcpServer and port problem
    By Talei in forum Qt Programming
    Replies: 4
    Last Post: 28th April 2009, 18:01
  2. QTcpServer & QTcpSocket questions...
    By jxmot in forum Qt Programming
    Replies: 2
    Last Post: 24th April 2008, 21:38

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.