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.
This application uses sockets to facilitate communication between the client and the server across the network.
- The script running on the client side connects to the the server at regular intervals of time.
- The server checks if there is any file to be transferred corresponding to the client id.
- 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
+---------------------+-------------+
| 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.
+---------------------+-------------+------------+
| 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.
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
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
Achal Saharan
Achyut Chaudhary
Abhishek Shivaram
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.