Thread: HTTP Server

  1. #1
    Registered User
    Join Date
    Jun 2003
    Posts
    23

    HTTP Server

    I am attempting to create an HTTP server in C++. Right now, the program only accepts a connection on port 80 and displays recieved text. When I run the program and type "[my IP]/index.html" into Internet Explorer, my program outputs the following:

    GET /index.html HTTP/1.1
    Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-shockwave-flash, */*
    Accept-Language: en-us
    Accept-Encoding: gzip, deflate
    User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)
    Host: [my IP]
    Connection: Keep-Alive



    (two line breaks at end)
    My question is, how do I send a file to a browser? Does it require a header? Simply sending text does not work.

  2. #2
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  3. #3
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    Try Ethereal.

  4. #4
    Registered User
    Join Date
    Jun 2003
    Posts
    23
    XSquared's link was helpful. Thank you for your help.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Tokenize HTTP server response
    By maganese187 in forum Networking/Device Communication
    Replies: 2
    Last Post: 03-09-2009, 07:17 AM
  2. Help with Parsing HTTP response from server
    By NuNn in forum C Programming
    Replies: 4
    Last Post: 02-19-2009, 03:02 PM
  3. HTTP Server?
    By Nebbuchadnezzar in forum Tech Board
    Replies: 9
    Last Post: 07-30-2005, 03:46 PM
  4. HTTP server failure.
    By adrianxw in forum Tech Board
    Replies: 5
    Last Post: 04-04-2003, 08:59 AM
  5. socket question
    By Unregistered in forum C Programming
    Replies: 3
    Last Post: 07-19-2002, 01:54 PM