Coder Social home page Coder Social logo

ayanpahari / http-downloader-socket-programming Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 782 KB

Implemented a simple HTTP-based downloader to download a given object specified by an URL and a set of URLs all at the same time in both Persistent and Non-Persistent HTTP.

C 100.00%
socket-programming httpdownloader persistent non-persistant http http-client c linux ubuntu

http-downloader-socket-programming's Introduction

HTTP Downloader - Socket Programming

Version 1

Implemented a simple HTTP based downloader to download a given object specified by an URL. Used a TCP connection and sent a HTTP request to download the file from the website.

Note

Sometimes due to heavy traffic to the website the code might not work in the 1st try and give an error saying 
“Domain Name doesn’t exist”, kindly run it atleast 2-3 times if that happens.

Instructions on running the program(Version 1)

Platform Used : Linux with GCC

Compiling the Codes :

gcc step1.c

Running the Client:

./a.out
  • The url is directly fed inside the code and will return an object of .gif format.

Screenshots Version 1

Output Screenshot

Version 2

  • Using Non-Persistent HTTP

      Wrote a downloader program to download the set of objects(.jpeg, .pdf, .gif) in the text file(input.txt) using non-persistent HTTP. It would create as many TCP connections as the number of objects in sequence.
    
  • Using Persistent HTTP

      Wrote a downloader program to download the set of objects in the text file(input.txt) using persistent HTTP without parallel TCP connections.
    

For Non-Persistent Connections: “Connection: close”

For Persistent Connections: “Connection: keep-alive”

Compared their performance(Persistent HTTP Vs Non-Persistent HTTP) in terms of time to download by providing the average time to download in a table. The detailed analysis of this can be found in the Report file.

Note

Sometimes due to heavy traffic to the website the code might not work in the 1st try and give an error saying “Domain Name doesn’t exist”, or for some url’s “301 Moved Permanently” . 
Kindly re-run it atleast 2-3 times until all the objects of different types are downloaded successfully.

Instructions on running the program(Version 2)

Platform Used : Linux with GCC

Compiling the Codes :

gcc step2.c , gcc step3.c

Running the Client:

./a.out input.txt

Screenshots Version 2(Non-Persistent HTTP)

Output Screenshot

Proof of Connection being Non-Persistent

Output Screenshot

Screenshots Version 2(Persistent HTTP)

Output Screenshot

Proof of Connection being Persistent

Output Screenshot

http-downloader-socket-programming's People

Contributors

ayanpahari avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.