Assignment 2
Assignment 2
For
each of the service classes, indicate if either UDP or TCP (or both) provides such a service.
ANSWER:
1. Reliable data transfer: - TCP only
2. A guarantee that a certain value for throughput will be maintained: - Neither TCP nor
UDP.
3. A guarantee that data will be delivered within a specified amount of time: - Neither TCP
nor UDP.
4. Security: - Neither TCP nor UDP.
QUESTION-2)) Recall that TCP can be enhanced with SSL to provide process-to-process
security services, including encryption. Does SSL operate at the transport layer or the application
layer? If the application developer wants TCP to be enhanced with SSL, what does the developer
have to do?
ANSWER:
Considering the data, we can say that TCP can be enhanced with SSL to provide process-to-
process security services, including encryption. Then the Secure socket layer (SSL) operate the
application layer, not transport layer.
The reason is that application layer is contains the high security and data hiding by encrypted
data. The SSL is operated at the application layer to provide the security and hide data in the
application by encrypting the data. The unencrypted data present in the Application layer is taken
by the SSL socket. The data is encrypted and then passed to the TCP socket. When the
application developer requires TCP to be enhanced with SSL, the application should include the
SSL code.
Question-3)) Telnet into a Web server and send a multiline request message. Include in the
request message the If-modified-since: header line to force a response message with the 304 Not
Modified status code. Show a screenshot of your commands and response. (hint: Telnet may not
be available in you current Windows by default. to make it available, go to Control Panel,
Programs and Features, Turn Windows Features On or Off, Check Telnet client.)
Answer:
“telnet” command:
It is a command used in windows (also in linux) to connect to the web server. The server
responds to the HTTP GET requests. It reply to the client with the requested information.
After establishing the connection with the web server, it is possible to request a specified page
from the web server. we run the following commands to send a multiline request message to the
server and use If-modified-since: header line to force a response message with not modified
status code.
Host: copland.udel.edu
If the page is available, then the server sends the page details. It include the “If-modified-since”
message with the 304 Not Modified status code in the response.
Question 4:
In Section 2.7, the UDP server described needed only one socket, whereas the TCP server
needed two sockets, why? If the TCP server were to support n simultaneous connections, each
from a different client host, how many sockets would the TCP server need? For the client-server
application over TCP, why must the server program be executed before the client program? Is
this true for client-server application over UDP?
Answer:
With the UDP server, there is no welcoming socket, and all data from different clients enters the
server through this one socket. With the TCP server, there is a welcoming socket, and each time
a client initiates a connection to the server, a new socket is created. Thus, to support and
simultaneous connections, the server would need n+1 sockets. In a TCP connection the server
program must be executed before the client program because if the server is not listening, the
client fails to establish connection with the server. For the UDP application, the client does not
initiate connections (or attempt to communicate with the UDP server) immediately upon
execution.
Question 5: Consider the following figure, for which there is an institutional network connected
to the Internet. Suppose that the average object size is 850,000 bits and that the average request
rate from the institution’s browsers to the origin servers is 16 requests per second. Also suppose
that the amount of time it takes from when the router on the internet side of the access link
forwards an HTTP request until it receives the response is 3 seconds on average. Mode the total
average response time as the sum of the average access delay (that is, the delay from Internet
router to institution router) and the average Internet delay, . For the average access delay use
∆/(1-∆β), where ∆ is the average time required to send an object over the access link and β is the
arrival rate of the objects to the access link.
a. Find the total average response time.
b. Now suppose a cache is installed in the institutional LAN. Suppose the miss rate
is 0.4. Find the total response time.
origin
servers
public
Internet
15 Mbps
access link
institutional
network
100Mbps LAN
Answer:
a. The time to transmit an object of size L over a link or rate R is L/R. The average time is
the average size of the object divided by R:
b. The traffic intensity on the access link is reduced by 60% since the 60% of the requests
are satisfied within the institutional network.
Thus the average access delay is
(.0567 sec)/[1 – (.4)(.907)] = .089 seconds.
The response time is approximately zero if the request is satisfied by the cache (which
happens with probability .6); the average response time is .089 sec + 3 sec = 3.089 sec for
cache misses (which happens 40% of the time). So the average response time is (.6)(0
sec) + (.4)(3.089 sec) = 1.24 seconds.
Thus the average response time is reduced from 3.6 sec to 1.24 sec.
Question 6:
Consider distributing a file of F=15 Gbits to N peers. The server has an upload rate of Us=30
Mbps, and each peer has a download rate of di=2 Mbps and an upload rate of u. For N=10, 100,
and 1000 and u=300Kbps, 700Kbps, and 2Mbps, prepare a chart giving the minimum
distribution time for each of the combinations of N and u for both client-server distribution and
P2P distribution.
Answer:
Us = 30 Mbps
d i = 2 Mbps
For calculating the minimum distribution time for client-server distribution , we use the
following formula:
Dcs = max {NF/Us, F/dmin}
Client Server
N
10 100 1000
U 300Kbps 7680 51200 512000
700Kbps 7680 51200 512000
2Mbps 7680 51200 512000
Peer to Peer
N
10 100 1000
U 300Kbps 7680 25904 47559
700Kbps 7680 15616 21525
2Mbps 7680 7680 7680
Question 7:
We have seen that Internet TCP sockets treat the data being sent as a byte steam but UDP sockets
recognize message boundaries. What are one advantage and one disadvantage of byte-oriented
API versus having the API explicitly recognize and preserve application-defined message
boundaries?
Answer:
Byte-oriented API: The TCP protocol is a byte-oriented API that the receiver receives the data
in reliable sequence order.
The byte-oriented API sends the data one byte after one byte as a continuous flow and each byte
is associated with a sequence number.
The UDP provides an unreliable service model. In UDP, the client and servers deliver and
receives the data as self-contained pieces in which each piece has meaning.
In the internet TCP socket connection, a direct virtual connection is established between the
client socket and server socket. The client’s socket sends arbitrary bytes of the data into this
connection. The server side of the TCP connection receives the data in the same order as the data
sent. A reliable byte stream flow is established between server and client.
The remote login applications such as Telnet and SSH (Secure Shell), the user operates the
computer remotely, therefore the data entered by the user should be transferred to the remote
computer in the same sequence rather than unreliable form. As a conclusion, byte-oriented API is
suitable for login applications.
Byte-oriented API doesn’t apply any implicit structure on the data stream. Hence, it sends the
data as a byte stream. That is, the sender can write only one byte in one write operation and the
receiver can receive only one byte in operation. Hence, bulk data transfers are not allowed with
byte-oriented streaming.
Preserve applications explicitly defines the maximum size of data that can write or read the data
in one operation by sender and receiver. Therefore, in preserving application, the sender can
write multiple bytes of data in one write and receiver can read multiple bytes of data in a single
read.
Question 8:
Suppose that in UDPClient.py, after we create the socket, we add the line:
clientSocket.bind((‘’, 5431))
Will it become necessary to change UDPServer.py? What are the port numbers for the sockets in
UDPClient and UDP Server? What are they before making this change?
Answer:
It’s not necessary to change the rest of the program in the UDP Server.
The socket can accommodate any port number, however. Here, the port number would be
assigned to match the client’s port number. The program would still work fine. The port numbers
for the sockets in UDPClient and UDPServer are now the following:
The port numbers for the sockets in UDPClient and UDPServer are now the following:
UDPClient= 5432
UDPServer= 2048.
UDPServer= 2048.