Skip to content

dubswalker1/challenge1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sender/Receiver

This is a simple python code project using asyncio to generate and send data from a "sender" server to a "receiver" server. It was written using Python 3.10.5.

Installation

Pull down this repo from github, then create the environment (ex. using venv):

git clone https://github.com/dubswalker1/challenge1.git
cd challenge1
py -m venv env
./env/Scripts/activate
py -m pip install -r requirements.txt 

Usage

Start the sender server (in one console):

python sender.py

Once started, the sender server will await a connection. Once connection is made (by the receiver), it will begin generating the sequence of binary output files and sending them to the connector.

Start the receiver server (in another console):

python receiver.py

Once started, the receiver should quickly begin receiving data from the sender. This will continue until 100 files have been generated by the sender and sent to the receiver. Once the final file is received, both the sender and receiver console output should both display matching totals for data sent and received on each end. Note: if started prior to the sender server, the receiver will continue to attempt to connect to the sender, until either it becomes available or a maximum retries of 10 is reached. At that point, the receiver will no longer attempt to connect and it will be necessary to restart (ctrl-C) the receiver to initiate the data transfer operation with the sender server.

To run the included pytest tests:

pytest

Note: 2/3 tests will fail if the sender and receiver servers have not been started before running pytest. Also, it is recommended that execution of pytest be performed after the sender server has completed sending to the receiver
and "waiting for something to send" is displayed in the console output.

Outputs

File output:

The sender will create an "outputs" folder in the current working directory and generate 100 files named "file_<#>.bits" where # is just an incremented index per file. Each of these files contains the randomized quantity of binary data generated by sender. These files will be overwritten every time a connection is opened with the sender.

Console output:

Sender and Receiver both output copious amounts of info to the console (sorry). When the sending of the 100 files is complete, sender will display a "total kb Generated" value, which should match the "Running Total Rcvd kb:" value output by receiver.

Contributing

Meh, don't bother, this is just a coding challenge

License

MIT

About

sender receiver

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages