https://github.com/prempreetbrar/tcpfiledownloader
A program that downloads a file from the Internet given a URL over TCP.
https://github.com/prempreetbrar/tcpfiledownloader
download-file file-downloader http http-client http-requests http-response https java network-programming non-persistent socket-client ssl streams tcp tcp-client tls
Last synced: 11 days ago
JSON representation
A program that downloads a file from the Internet given a URL over TCP.
- Host: GitHub
- URL: https://github.com/prempreetbrar/tcpfiledownloader
- Owner: prempreetbrar
- Created: 2024-02-23T20:59:10.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-04-23T00:42:08.000Z (about 1 year ago)
- Last Synced: 2025-04-08T21:46:27.801Z (3 months ago)
- Topics: download-file, file-downloader, http, http-client, http-requests, http-response, https, java, network-programming, non-persistent, socket-client, ssl, streams, tcp, tcp-client, tls
- Language: Java
- Homepage:
- Size: 28.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# TCP File Downloader
A program that downloads a file from the Internet given a URL over TCP. Watch a gif of me interacting with it below!

## Features
- Supports both `HTTP` and `HTTPS` URLs; if the protocol is `HTTP`, a regular `Socket` is used to establish a TCP connection; if the protocol is `HTTPS`,
a secure connection is established with the server using an `SSLSocket`.
- Operates in non-persistent HTTP mode; once the object is downloaded, the client closes the underlying TCP connection.
- URLs must be properly formatted with the following syntax: `protocol://hostname[:port]/pathname`, where `protocol` is either HTTP or HTTPS,
`hostname` is the name of the web server, `[:port]` is an optional part which specifies the server port (default is 80 for HTTP and 443 for HTTPS),
`pathname` is the path of the requested object on the specified host.
- Reads the server response line by line to first identify the end of the header fields (by looking for `\r\n`), and then reads the
remainder of the server's response (the file itself) chunk-by-chunk using a buffer for improved performance.## If you want to start up the project on your local machine:
1. Download the code as a ZIP:

3. Unzip the code:

4. Open the folder in an IDE, such as VSCode:

5. Obtain the URL of a file from the internet, copy it. Then, run the code by doing
```javac *.java
java ClientDriver -u
```

6. Interact with the file as you please!
