Thread: Connecting to servers (sockets?)

  1. #1
    Registered User
    Join Date
    Jun 2009
    Posts
    45

    Connecting to servers (sockets?)

    How, in C++, do you get files from something like a standard http server? Say I'm trying to get the file from downloads.example.org/package.tar.gz .
    I assume you can do that, all I've managed to read so far suggests the server needs to be specially set up.
    Last edited by Muscovy; 07-02-2009 at 07:46 PM. Reason: grammer error.

  2. #2
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    I'd imagine you'd establish a connection to the standard HTTP port (80) and then send an HTTP request. I don't know the format for that, but you can probably find it online.

    BTW, you could use the program wget to simplify this, because it will do all the HTTP work for you, and you can just execute "wget http://google.ca/".

    [edit] And the server is specially set up. It has to be running the HTTP daemon. [/edit]
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  3. #3
    Registered User
    Join Date
    Jun 2009
    Posts
    45
    By 'the http daemon', do you mean the sort of thing that is essentially any http server?
    What I want to know is if servers I connect to need to be Linux friendly or simmilar.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. inet_aton()... Noob needs help with sockets :|
    By Maz in forum C++ Programming
    Replies: 3
    Last Post: 11-22-2005, 04:33 PM
  2. Raw Sockets and SP2...
    By Devil Panther in forum Networking/Device Communication
    Replies: 11
    Last Post: 08-12-2005, 04:52 AM
  3. Asynchronous sockets
    By dpro in forum Networking/Device Communication
    Replies: 4
    Last Post: 12-20-2004, 06:53 PM
  4. Connecting to servers ect
    By Seph_31 in forum Networking/Device Communication
    Replies: 4
    Last Post: 12-02-2003, 08:25 AM
  5. Starting window sockets
    By _Cl0wn_ in forum Windows Programming
    Replies: 2
    Last Post: 01-20-2003, 11:49 AM