Sale!

COEN 146 Lab assignment 4: File distribution: Client- Server vs. P2P solved

Original price was: $35.00.Current price is: $30.00. $25.50

Category:

Description

5/5 - (7 votes)

Objectives
1. To build a TCP client server file distribution and UDP Peer-to-Peer (P2P)
Client-Server and P2P file distribution
In Lab 3, you have developed a UDP-TCP/IP client/server to transfer file. With UDP no connection is established,
but TCP a connection is established between a client and server. In class and, you have seen file distribution to N
peers by using client-server and P2P. With client-server file distribution, the distribution time increases linearly
and without bound as the number of peers increases. However, with P2P file distribution, the minimal distribution
time is not only always much less than the distribution time of the client-server architecture, but also less than a
fixed time for any number of peers N. Thus, P2P can be self-scaling. This scalability is a direct consequence of
peers being redistributors.
The TCP server needs to be designed as concurrent server. This means when a client sends a request for a file
transfer, the sever accepts the connection request and spawns a thread to handle this transfer on the connection
descriptor. The server will then continue in a loop to wait for another client connection request to handle another
transfer.
In this lab, you will demonstrate file distribution for N peers using Client-server and P2P.
Multiple Clients – Concurrent Server with TCP/IP for client-server file distribution
Step 1. Write a concurrent TCP server that accepts and responds to multiple client connection requests for file
transfer. You may modify your TCP server in Lab3 so that when the server accepts a connection from a
client it spawns a separate thread to handle this specific client connection for file transfer.
Note: You will have a number of threads (at the same time) running on the server transferring copies of
src.dat files to clients that will save at their destination as – dst.dat file.
Demonstrate to the TA, multiple clients making file transfer request to the server and that the server
makes multiple transfers at the same time. Make N = 5. Upload your source code to Camino.
Multiple Clients with UDP/IP for P2P file distribution
Step 2. In lab3, you demonstrated P2P file distribution between two hosts using UDP. You may run multiple
clients interacting at the same time transferring files in a P2P architecture.
Demonstrate to the TA, the scalability of Client-Server and P2P file distribution for multiple clients.
Please check Section 2.5 of your textbook.

Requirements to complete the lab
Show the TA correct execution of the programs you wrote and upload source code to Camino.
Be sure to retain copies (machine and/or printed) of your source code. You will want these for study purposes and
to resolve any grading questions (should they arise)
Please start each program with a descriptive block that includes minimally the following information:
/*
* Name:
* Date:
* Title: Lab4 – ….
* Description: This program …
*/