Socket program doubt

This is a discussion on Socket program doubt within the C Programming forums, part of the General Programming Boards category; Hi folks, I am a beginner in Socket Programming. I am trying to do some simple stuff but had a ...

  1. #1
    Registered User
    Join Date
    Jul 2010
    Posts
    2

    Socket program doubt

    Hi folks,

    I am a beginner in Socket Programming. I am trying to do some simple stuff but had a basic query.

    I would like to implement something similar to wget in C using TCP sockets (i.e., without using any HTTP libraries). Just give a URL (Example-- $wget www.foo.com/bar.pdf) through command line, construct a HTTP GET request to download the file identified by the URL, and download and save file.

    Right now trying this only for static HTTP content, but later want to modify for crawling entire site.

    Can someone point out how to begin? What are the steps involved?

    Thanks in advance.
    G

  2. #2
    a_capitalist_story
    Join Date
    Dec 2007
    Posts
    2,650
    May I ask why you'd bother reinventing the wheel when there are options like libcurl out there?

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,548
    Well C won't do that without a lot of code on your part.

    To match your description of the work you want to do, you need something like cURL and libcurl

    If you really want to roll your own everything, then read "beej"
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  4. #4
    Registered User
    Join Date
    Jul 2010
    Posts
    2
    I just need to do it without using the HTTP libraries...

  5. #5
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,548
    No problem - just read beej to figure out how to open a network connection.

    Then read this to figure out what it all means.
    Hypertext Transfer Protocol -- HTTP/1.1
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Gtk Plug, Socket, embed one program into another.
    By arkashkin in forum Linux Programming
    Replies: 2
    Last Post: 03-27-2010, 01:01 AM
  2. Client-server system with input from separate program
    By robot-ic in forum Networking/Device Communication
    Replies: 3
    Last Post: 01-16-2009, 02:30 PM
  3. Writing to an Output Socket in use by another program
    By maththeorylvr in forum Windows Programming
    Replies: 4
    Last Post: 10-28-2005, 12:17 PM
  4. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  5. my server program auto shut down
    By hanhao in forum Networking/Device Communication
    Replies: 1
    Last Post: 03-13-2004, 09:49 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21