In this project we implemnted a chat room using python. Clients can connect to the room send a recive messages to all other clients or to a specific client. Also clients can download files from the server using our new reliable UDP protocol.
We implemented a new reliable UDP protocol baset on the selective repeat algorithm.
We divide our file into parts and give each part a sequnce number between 0 to 9 (modulo 10).
For each part the server send to the client, the client will response with ACK (the seq number he got).
When the server recive an ACK from the client he marks that specific packet so he will know not to send it again.
If the packet wasnt marked the server will send it again until he will get an ACK.
The client can run only after the server is already running!
The client have number of code words he can use:
- 'disconnect' - For disconnecting.
- 'get_users' - Get a list with all users in the chat room.
- 'set_msg_all' - Next messages will be send to all users.
- 'set_msg' - Next message will be send only to a specific user
- 'get_list_file' - Get a list with all the file in the server you can download
- 'download_file' - Request to download a file froim the server.
Run the 'client' program.
Send the message 'disconnect'
Typing any message that isn't a code word (Case Sensitive!)
OK examples:
'Disconnect'
'udp is cool'
Type 'set_msg' and the nickname of the participent you wish to contact.
Remember! Until you set the chat back tou public, all your messages will be sent only to the participant you chose.
For example- to privately send messages to 'Amit', we write 'set_msgAmit'
Type 'set_msg_all'
Type 'get_users'
Type 'get_list_file'
In order to download a file from the server's file list, type 'download_file' add space and enter the file name + file extension. If successful, after downloading 40% you will be asked to confirm the rest of the download (or not). Finally, you will be asked to provide the new file name + file extension.
At each iteration of sending data we save the time of the first packet that we send
when we recive an ACK for that packet we calculate the RTT (current time - marked time)
with that information we calculate the new estimated RTT using this formula :
EstimatedRTT = (1- a)EstimatedRTT + aSampleRTT.
When a = 0.125
- In case packet from the server to the client is lost the client will not send an ACK for that packet, so the server will send it again.
- In case packet from the client to the server was lost(ACK), the server will send again the the data but the client will see he allready got that packet so he will send back ACK automatically
Server on the left client on the right
Star of the download until proceed: