---
tags: Computer Network
---
# NCCUCS NET22 HW02
## R1
**List five nonproprietary Internet applications and the application layer protocols that they use.**
:::success
Several non-proprietary Internet applications and the application layer protocols that they use are:
1. Web: HTTP
2. Remote login: Telnet
3. Network News: NNTP
4. E-mail: SMTP, IMAP, POP3
5. File Transfer: FTP
6. BitTorrent File Sharing: BitTorrent Protocol
:::
<br>
## R2
**What is the difference between network architecture and application architecture?**
:::success
The difference between network architecture and application architecture is:
Network architecture can handle the communication process into layers in the network organizations (e.g. OSI 7-Layer Model & TCP/IP Model), whereas an application developer is a design to application architecture (e.g. client-server & P2P).
:::
<br>
## R5
**What information is used by a process running on one host to identify a process running on another host?**
:::success
The IP address and port numbers are used by a process running on one host to identify a process running on another host.
:::
<br>
## R8
**List the four broad classes of services that a transport protocol can provide. For each of the service classes, indicate if either UDP of TCP (or both) provides such a service.**
:::success
Four broad classes of services that a transport protocol can provide:
1. Reliable data transfer: Only TCP
2. A guarantee that a certain value for throughput will be maintained: Neither
3. A guarantee that data will be delivered within a specified amount of time: Neither
4. Security: Neither
:::
<br>
## R9
**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?**
:::success
1. TCP can be enhanced with Secure Socket Layer (SSL) to provide process-to-process security services, including encryption.
2. The SSL operates the application layer, not transport layer.
3. If the application developer wants TCP to be enhanced with SSL, he has to include the SSL code in the application.
:::
<br>
## R11
**What does a stateless protocol mean? Is IMAP stateless? What about SMTP?**
:::success
A stateless protocol maintains no information about the clients. IMAP and SMTP are stateful.
:::
<br>
## R14
**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.**
:::success
Command to open the connection with web server:
telnet <domain name of web server> <port number>
After establishing the connection with the web server, it is possible to request a specified page from the web server.
Command to request the page web server:
GET <page name> HTTP/1.0
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.
:::
<br>
## R17
**Print out the header of an e-mail message you have recently received. How many Received: header lines are there? Analyze each of the header lines in the message.**
:::success
1. Received: This header field indicates the sequence in which the SMTP servers send and receive the mail message including the respective timestamps.
2. Message-id: This header field is a unique string assigned by the mail system when the message is first created.
3. From: This indicates the email address of the sender of the mail.
4. To: This field indicates the email address of the receiver of the mail.
5. Subject: This gives the subject of the mail (if any specified by the sender).
6. Date: The date and time when the mail was sent by the sender.
7. Mime-version: MIME version used for the mail. In the example, it is 1.0.
8. Return-Path: This specifies the email address to which the mail will be sent if the receiver of this mail wants to reply to the sender. This is also used by the sender's mail server for bouncing back undeliverable mail messages of mailer-daemon error messages.
:::
<br>
## P1
**True or false?**
### (a.)
**A user requests a Web page that consists of some text and three images. For this page, the client will send one request message and receive four response messages.**
:::success
False
:::
### (b.)
**Two distinct Web pages (for example, www.mit.edu/research.html and www.mit.edu/students.html ) can be sent over the same persistent connection.**
:::success
True
:::
### (c.)
**With nonpersistent connections between browser and origin server, it is possible for a single TCP segment to carry two distinct HTTP request messages.**
:::success
False
:::
### (d.)
**The Date: header in the HTTP response message indicates when the object in the response was last modified.**
:::success
False
:::
### (e.)
**HTTP response messages never have an empty message body.**
:::success
False
:::
<br>
## P2
**SMS, iMessage, and WhatsApp are all smartphone real-time messaging systems. After doing some research on the Internet, for each of these systems write one paragraph about the protocols they use. Then write a paragraph explaining how they differ.**
:::success
SMS(Short Message Service) is commonly known as Text message. With SMS, we can send a text message of upto 160 characters to other device. If the length of the message exceeds 160 characters then the message is split into smaller messages and then sent to the device. Most of the cellphones and smartphones support the SMS messenger. SMS uses SMPP protocol to transmitting text messages. SMPP stands for Short Message Peer to Peer Protocol and it is used whenever a text message is sent from one device to another device. SMPP is used to send and receive messages from and to GSM, UMTS, iDEN,CDMA and TDMA cell phones. This protocol is a layer-7 protocol, which allows fast deliver of SMS messages.
iMessage is a messaging system that works on apple devices and are not available to non-Apple devices. iMessages are texts, photos, or videos that you send to iOS devices and Mac devices over WiFi or cellular-data networks. These messages are always encrypted and appear in blue text bubbles. iMessage uses a protocol that is based on Apple Push Notification Service (APNs) which is a proprietary, binary protocol. This protocol sets up a keep-alive connection with serves of Apple. Every connection has its own unique code that pretends as identifier for the route used to send message to a specific device.
WApp is the popular texting service that is free to download for smartphones. It replaces regular text messaging service. WApp uses internet connection to send text, photos, audio, video, document and live location to other device which is installed with WApp. Using internet we can send data to another device at faster rate compared to text messaging service. WApp uses open standard XMPP(Extensible Messaging and Presence Protocol). which uses XML as its syntax.
SMS, iMessage and WApp are most commonly used services on the smartphones. But they are different from each other. SMS doesnt require an internet connection but iMesssage and WApp require internet connection to transmit the data from one device to another device. In SMS we can send only text and images but in iMessage and WApp we can send text, photos and videos. In SMS the text messages are not encrypted but coming to iMessage an WApp the text messages are encrypted and stored in the cloud. The backup feature is available for both iMessage and WApp but not for SMS regular text messaging service. SMS and WApp works on every device like android, iOS etc., but iMessage works only for apple devices and the messages are encrypted only when transmission is done between two apple users otherwise it is non-encrypted for non-apple users. iMessage provides security using apple user account authentication. The only advantage of WApp is, it is a cross-platform messaging system. iMessage is faster than SMS and WApp is faster than iMessage.
:::
<br>
## P4
**Consider the following string of ASCII characters that were captured by Wireshark when the browser sent an HTTP GET message (i.e., this is the actual content of an HTTP GET message). The characters```<cr><lf>``` are carriage return and line-feed characters (that is, the italized character string```<cr>```in the text below represents the single carriage-return character that was contained at that point in the HTTP header). Answer the following questions, indicating where in the HTTP GET message below you find the answer.**

### (a.)
**What is the URL of the document requested by the browser?**
:::success
The URL of the document request is http://gaia.cs.umass.edu/cs453/index.html. The Host field indicates the server's name and /cs453/index.html indicates the file name.
:::
### (b.)
**What version of HTTP is the browser running?**
:::success
The browser is running HTTP version 1.1, as indicated just before the first pair.
:::
### (c.)
**Does the browser request a non-persistent or a persistent connection?**
:::success
The browser is requesting a persistent connection, as indicated by the Connection: keep-alive header.
:::
### (d.)
**What is the IP address of the host on which the browser is running?**
:::success
This information is not contained in an HTTP message anywhere. So there is no way to tell this from looking at the exchange of HTTP messages alone.
:::
### (e.)
**What type of browser initiates this message? Why is the browser type needed in an HTTP request message?**
:::success
Mozilla/5.0. This can be found in the User-Agent header.
:::
<br>
## P5
**The text below shows the reply sent from the server in response to the HTTP GET message in the question above. Answer the following questions, indicating where in the message below you find the answer.**

### (a.)
Was the server able to successfully find the document or not? What time was the document reply provided?
:::success
The server was able to locate the document successfully. This can be shown at the status code 200 and the phrase OK.
:::
### (b.)
When was the document last modified?
:::success
The document index.html was last modified on Saturday 10 Dec 2005 18:27:46 GMT.
:::
### (c.)
How many bytes are there in the document being returned?
:::success
There are 3874 bytes in the document being returned.
:::
### (d.)
What are the first 5 bytes of the document being returned? Did the server agree to a persistent connection?
:::success
The first five bytes of the returned document are : <!doc. The server agreed to a persistent connection, as indicated by the Connection: Keep-Alive header.
:::
<br>
## P7
**Assume that the RTT between a client and the local DNS server is TTl, while the RTT between the local DNS server and other DNS servers is RTTr. Assume that no DNS server performs caching.**


### (a.)
What is the total response time for the scenario illustrated in top figure on the right?
:::success
$2 \mathrm{TT}_1+3 \mathrm{RTT}_r$
( $1 \mathrm{TT}_1$ for connection, $1 \mathrm{TT}_1+3 \mathrm{RTT}_r$ for request)
:::
### (b.)
What is the total response time for the scenario illustrated in bottom figure on the right?
:::success
$2 \mathrm{TT}_1+3 \mathrm{RTT}_{\mathrm{r}}$
(1 $\mathrm{TT}_1$ for connection, $1 \mathrm{TT}_1+3 \mathrm{RTT}_{\mathrm{r}}$ for request)
:::
### (c.)
Assume now that the DNS record for the requested name is cached at the local DNS server. What is the total response time for the two scenarios?
:::success
$2 \mathrm{TT}_1$ for both figures
(1 $\mathrm{TT}_1$ for connection, $1 \mathrm{TT}_1$ for request)
:::
<br>
## P8
**Referring to Problem P7, suppose the HTML file references eight very small objects on the same server. Neglecting transmission times, how much time elapses with?**
### (a.)
Non-persistent HTTP with no parallel TCP connections?
:::success
$18 \mathrm{TT}_1+3 \mathrm{RTT}_{\mathrm{r}}$
( $18 \mathrm{TT}_1$ for connection + request for HTML file $+8$ references, $3 \mathrm{RTT}_{\mathrm{r}}$ for the non-local DNS servers)
:::
### (b.)
Non-persistent HTTP with the browser configured for 5 parallel connections?
:::success
$6 \mathrm{TT}_1+3 \mathrm{RTT}_{\mathrm{r}}$
( $1 \mathrm{TT}_1$ for connection, $1 \mathrm{TT}_1$ for HTML request, $2 \mathrm{TT}_1$ for 5+3 parallel connections, $2 \mathrm{TT}_1$ for 8 object requests, $3 \mathrm{RTT}_r$ for the non-local DNS servers)
:::
### (c.)
Persistent HTTP?
:::success
$3 \mathrm{TT}_1+3 \mathrm{RTT}_{\text {r }}$
(1 $\mathrm{TT}_1$ for connection, $1 \mathrm{TT}_1$ for HTML request, $1 \mathrm{TT}_1$ for 8 object requests, $3 \mathrm{RTT}_{\mathrm{r}}$ for the non-local DNS servers)
:::
<br>
## P9


### (a.)
Find the total average response time.
:::success
The time to transmit an object of size L over a link or rate R is L/R = (850,000 bits)/(15,000,000 bits/sec) = .0567 sec.
The traffic intensity on the link is given by = (16 requests/sec)*(0.0567 sec/request) = 0.907.
Thus, the average access delay is (0.0567 sec) / (1 - 0.907) = 0.6 seconds.
The total average response time is therefore 0.6 sec + 3 sec = 3.6 sec.
:::
### (b.)
Now suppose a cache is installed in the institutional LAN. Suppose the miss rate is 0.4. Find the total response time.
:::success
The average access delay is (0.0567 sec)/[1 – (0.4)(0.907)] = 0.089 seconds.
The response time is approximately zero if the request is satisfied by the cache (which happens with probability 0.6); the average response time is 0.089 sec + 3 sec = 3.089 sec for cache misses (which happens 40% of the time).
So the average response time is (0.6)(0 sec) + (0.4)(3.089 sec) = 1.24 seconds.
Thus the average response time is reduced from 3.6 sec to 1.24 sec.
:::
## P10

### (a.)
Nonpersistent HTTP with serial connections
:::success
The Non presistent HTTP with Serial Connections: 2RTT for TCP connection (1RTT to setup TCP conn. and 1 RTT to request and receive the object)
Since Download Rate = 1 Mbps and RTT = 100 ms, propogation delay = 50 ms
Therefore, the transmission time = 24 * 50 + 408 = 1608 (ms)
:::
### (b.)
Nonpersistent HTTP with two parallel serial connections
:::success
Transmission time = 16 * 50 + 2008 = 2808 (ms)
:::
### (c.)
Nonpersistent HTTP with six parallel serial connections
:::success
Transmission time = 8 * 50 + 2008 = 2408 (ms)
:::
### (d.)
Persistent HTTP with one connections
:::success
Transmission time = 14 * 50 + 408 = 1108 (ms)
:::
<br>
## P11

:::success
:::
<br>
## P15
**Read RFC 5321 for SMTP. What does MTA stand for? Consider the following received spam e-mail (modified from a real spam e-mail). Assuming only the originator of this spam e-mail is malicious and all other hosts are honest, identify the malacious host that has generated this spam e-mail.**

:::success
"asusus-4b96 [58.88.21.177]” is the spam mail.
:::
<br>
## P16
**Read the DNS SRV RFC, RFC 2782 . What is the purpose of the SRV record?**
:::success
Services Record (SRV) is defined in RFC 2782. A Service record (SRV record) is a specification of data in the Domain Name System defining the location, i.e., the hostname and port number, of servers for specified services. The SRV RR identifies the host(s) that will support a particular service.
:::
<br>
## P17
### (a.)

:::success
C: dele 1
C: retr 2
S: blah blah …
S: ………..blah
S: .
C: dele 2
C: quit
S: +OK POP3 server signing off
:::
### (b.)

:::success
C: retr 2
S: blah blah …
S: ………..blah
S: .
C: quit
S: +OK POP3 server signing off
:::
### (c.)
Suppose you have configured your POP mail client to operate in the download-and-keep mode. Using your transcript in part (b), suppose you retrieve messages 1 and 2, exit POP, and then five minutes later you again access POP to retrieve new e-mail. Suppose that in the five-minute interval <span style=color:red>no new messages have been sent to you</span>. Provide a transcript of this second POP session.
:::success
C: list
C: retr 1
S: ~ERR: no new messages
C: quit
S: +OK POP3 server signing off
:::
<br>
## P20



:::success
Suppose file is cached by proxy server, so no request will go to public network as file is cached.
In the case of no proxy installed:
end-end delay without proxy = Internet delay(RTT) + access link delay + LAN delay
In the case of proxy server installed, no request will go to public network as it will be fullifilled by proxy server. So, end-end delay with proxy = LAN delay $+$ proxy delay (delay when satisfied at cache).
File transfer will takes less time when a proxy is installed if end-end delay without proxy > end-end delay with proxy
(i.e., Internet delay(RTT) + access link delay + LAN delay > LAN delay + proxy delay)
LAN delay same on both side so eliminate it and RTT $=0$ as mentioned in question, access link delay = NL/Rb, proxy delay = NL/Rl.
Hence, file transfer will takes less time when a proxy is installed if,
$$
\mathrm{NL}/\mathrm{Rl}>\mathrm{NL}/\mathrm{Rb}
$$
So, File transfer will takes less time when a proxy is installed if,
$$
\mathrm{Rl}>\mathrm{Rb}
$$
:::
<br>
## P22

:::success
$\mathrm{F}=15$ Gbits $=15360$ Mbits (Convert 1 Gbits $=1024$ Mbits)
$s=30$ Mbps
$d_i=2$ Mbps
minimum distribution time:
$$
\begin{aligned}
D_{c s} &=\max \left\{\frac{N F}{u_s}, \frac{F}{d_{\min }}\right\} \\
&=\max \left\{\frac{10 \times 15360}{30}, \frac{15360}{2}\right\} \\
&=\max \{5120,7680\} \\
&=7680 \mathrm{sec}
\end{aligned}
$$
So, the minimum distribution time for each of the combinations of $N$ and $u$ for both client-server distribution and P2P distribution $=7680$ seconds
:::
<br>
## P23

### (a.)
:::success
The download rate of the client is more, the server can transmit maximum at the rate of $\frac{u_s}{N}$.
Thus, the client can receive the file at the rate of $\frac{u_s}{N}$.
Total times required for a client to receive the complete file is $\frac{F}{\left(\frac{u_s}{N}\right)}=\frac{N F}{u_s}$.
So, the time required for all the clients to receive the entire file is $\frac{N F}{u_s}$.
:::
### (b.)
:::success
Ttotal time essential for a client to receive the complete file is $d_{\min }$.
The time essential for all the clients to receive the entire file is $\frac{F}{d_{\min }}$.
:::
### (c.)
:::success
The actual distribution time of a file in client-server distribution is
$$
D_{C S} \geq \max \left\{\frac{N F}{u_s}, \frac{F}{d_{\min }}\right\}
$$
But from part (a.) $D_{C S} \leq \frac{N F}{u_s}$
Combine above two results to get the following result:
$$
D_{C S}=\frac{N F}{u_s}
$$
:::
<br>
## P24

### (a.)
:::success
a) Assume $u_1, u_2, \cdots, u_N$ are the bandwidths and combined bandwidths:
$$
\begin{aligned}
&u=u_1+u_2+\cdots+u_N \\
&u_s \leq \frac{\left(u_s+u\right)}{N}
\end{aligned}
$$
Divide it into $N$ parts.
The size of the packet $=\left(\frac{u_i}{u}\right) F$, where $i$ indicates the packet number.
$$
\begin{aligned}
&r_i=\left(\frac{u_i}{u}\right) u_s \\
&r_1+r_2+\cdots+r_N=u_s
\end{aligned}
$$
The overall forwarding rate of each peer is $(N-1) r_i$.
$$
(N-1) r_i=(N-1)\left(\frac{u_i}{u}\right) u_s
$$
$$
(N-1) r_i \leq u_i
$$
The total rate at which the peer receives the bits of the file is given by the following equation:
$$
r_i+\sum_{j=i} r_j=u_s
$$
Therefore, the time required to receive the complete file by each peer (client) is $\frac{F}{u_s}$
:::
### (b.)
:::success
Assume that the rate of transmission from server to the is given by the following equation:
$$
u_s \geq \frac{\left(u_s+u\right)}{N}
$$
The combined rate of transmission of the server is given by the following equation:
$$
\begin{aligned}
r_1+r_2+\cdots+r_N+N r_{N+1} &=\frac{u}{(N-1)}+u_s-\frac{u}{(N-1)} \\
&=u_s
\end{aligned}
$$
The total rate at which the peer receives the bits of the file is given by the following equation:
$$
\begin{aligned}
r_i+r_{N+1}+\sum_{j \neq i} r_j &=\frac{u}{(N-1)}+\frac{\left(u_s-\frac{u}{(N-1)}\right)}{N} \\
&=\frac{\left(u_s+u\right)}{N}
\end{aligned}
$$
Therefore, the time required to receive the complete file by each peer (client) is $\frac{N F}{\left(u_s+u\right)}$
:::
### (c.)
:::success
The equation for minimum distribution time is give below:
$$
D_{P 2 P} \geq \max \left\{\frac{F}{u_s}, \frac{N F}{\left(u_s+u\right)}\right\}
$$
$$
D_{P 2 P}=\max \left\{\frac{F}{u_s}, \frac{N F}{\left(u_s+u_1+u_2+\cdots+u_N\right)}\right\}
$$
:::
<br>
## P26

### (a.)
:::success
Suppose a DASH system for which there are $\mathrm{N}$ video versions (at $\mathrm{N}$ different rates and qualities) and $\mathrm{N}$ audio versions (at $\mathrm{N}$ different rates and versions).
If we create files so that the audio is mixed in with the video, so server sends only one media stream at given time, then $\mathrm{N} * \mathrm{N}=\mathrm{N}^2$ files will the server need to store.
:::
### (b.)
:::success
If the server instead sends the audio and video streams separately and has the client synchronize the streams, then $N+N=2 N$ files will the server need to store.
:::
<br>
## P27

### (a.)
:::success
If you run TCPClient first, then the client will attempt to make a TCP connection with a non-existent server process. A TCP connection will not be made.
:::
### (b.)
:::success
UDPClient doesn't establish a TCP connection with the server. Thus, everything should work fine if you first run UDPClient, then run UDPServer, and then type some input into the keyboard.
:::
### (c.)
:::success
If you use different port numbers, then the client will attempt to establish a TCP connection with the wrong process or a non-existent process. Errors will occur.
:::
<br>
## P28

:::success
Moidfied code:

After modifications then the Port numbers of client and server:
DP Client port number - 5432
UDP Server port number - 12000
Before modifications the Port numbers of client and server :
UDP Client port number - xxxx (number assigned by OS)
UDP Server port number - 12000
:::