Skip to content

A service that lets servers automatically send files to clients.

Notifications You must be signed in to change notification settings

achalsaharan/file-transfer-service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

File Transfer Service

A service that lets servers automatically transfer files to clients. The clients polls the server at regular intervals, the server checks for updates and transfers the files to the clients.

This service can be used to automatically send software updates, security patches or any type of files to the clients.

How It Works

This application uses sockets to facilitate communication between the client and the server across the network.

  1. The script running on the client side connects to the the server at regular intervals of time.
  2. The server checks if there is any file to be transferred corresponding to the client id.
  3. If there is a file to be transferred the server sends the file else the connection is closed.

The client and server use custom header and message formats to communicate with each other

Message Format

Client Request Format

+---------------------+-------------+
| fixed length header | JSON header |
+---------------------+-------------+
  • Fixed length header is a 2 byte header which is used to tell the size of the JSON header.
  • The JSON header can be of any size and contains information like the client-id, request-type etc in the form of key value pairs.

Server Response Format

+---------------------+-------------+------------+
| fixed length header | JSON header | file bytes |
+---------------------+-------------+------------+
  • Fixed length header is a 2 byte header which is used to tell the size of the JSON header.
  • The JSON header can be of any size and contains information like the file-name, file-size, file-hash etc in the form of key value pairs.
  • File bytes are the binary bytes of the file. The client receives these bytes and saves them in a file with the file-name sent in the fixed length header.

How To Run

Server

The server folder contains the server application, to run the server application.
python3 fileServer.py
To configure the HOSTNAME and PORT go to serverConfig.py

Client

The server folder contains the client application, to run the client application.
python3 fileClient.py
To configure the HOSTNAME and PORT go to clientConfig.py

Team

Achal Saharan
Achyut Chaudhary
Abhishek Shivaram

Acknowledgements

The article on Socket Programming in Python helped in understanding how to use select with non-blocking sockets to make a server that can handle multiple connections at a time.

About

A service that lets servers automatically send files to clients.

Topics

Resources

Stars

Watchers

Forks

Languages