Results 1 to 6 of 6

Thread: QHttp : Host vs IP adress

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2007
    Posts
    158
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    25

    Default QHttp : Host vs IP adress

    Hello,

    I'm using QHttp objects to fll a form, submit it and download the server response.
    So I made 2 QHttp objects : the first fill the form with a POST header, and the second download the response with a GET header.

    Working under Windows 2000 / XP, I've added the host value in the HOST file of the system :
    Qt Code:
    1. # Copyright (c) 1993-1999 Microsoft Corp.
    2. #
    3. # Ceci est un exemple de fichier HOSTS utilisé par Microsoft TCP/IP
    4. # pour Windows.
    5. #
    6. # Ce fichier contient les correspondances des adresses IP aux noms d'hôtes.
    7. # Chaque entrée doit être sur une ligne propre. L'adresse IP doit être placée
    8. # dans la première colonne, suivie par le nom d'hôte correspondant. L'adresse
    9. # IP et le nom d'hôte doivent être séparés par au moins un espace.
    10. #
    11. # De plus, des commentaires (tels que celui-ci) peuvent être insérés sur des
    12. # lignes propres ou après le nom d'ordinateur. Ils sont indiqué par le
    13. # symbole '#'.
    14. #
    15. # Par exemple :
    16. #
    17. # 102.54.94.97 rhino.acme.com # serveur source
    18. # 38.25.63.10 x.acme.com # hôte client x
    19.  
    20. 127.0.0.1 localhost
    21. 192.168.1.12 courriel
    To copy to clipboard, switch view to plain text mode 

    So my host is "courriel", with the IP adress 192.168.1.12
    Everything forks fine... On my computer .
    When I want to use my application on other computer, I get an error cause the QHttp objects can't find the host value for "courriel". Of course, the HOST file hasn't been edited !

    So, I used directly the IP adress in my application, but then I get a 404 error : host not found .

    Qt Code:
    1. IL_http = new QHttp("192.168.1.12", 80);
    2.  
    3. QHttpRequestHeader header("POST", "/index.php?tg=login&cmd=signon");
    4. header.setValue("Host", "192.168.1.12");
    5. header.setContentType("application/x-www-form-urlencoded");
    6. header.setContentLength(content.length());
    7.  
    8. IL_httpId = IL_http->request(header, content);
    To copy to clipboard, switch view to plain text mode 

    The QHttp constructeur needs a "hostname" and not a "host adress", but is it possible to work directly with an IP adresse ?
    Else, is it possible to set a host reference oly for this application ? like an intrnal host file ?
    Last edited by Nyphel; 10th April 2007 at 14:53.

Similar Threads

  1. Setting a cookie for a Qhttp connection
    By Nyphel in forum Newbie
    Replies: 16
    Last Post: 5th April 2007, 15:30
  2. Qtopia host side development environment for ARM target.
    By hvreddy1110 in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 11th October 2006, 15:05
  3. how to use QHttp inside QThread in Qt3
    By alusuel in forum Qt Programming
    Replies: 3
    Last Post: 14th July 2006, 11:19
  4. QHttp related
    By whoops.slo in forum Qt Programming
    Replies: 12
    Last Post: 20th June 2006, 20:57
  5. using Qhttp with www(x) sites
    By importantman in forum Qt Programming
    Replies: 18
    Last Post: 4th April 2006, 00:12

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.