34
Class: TE Computers Academic Year: 2017-18 SEM:- II Subject : Computer Networks Exam: ENDSEM Marks:70 Paper Solution By: Prof. B.A.Khivsara Q1 a) Differentiate between OSI and TCP/IP Model [4] Ans: Basis for Comparison TCP/IP Model OSI Model Expands To TCP/IP- Transmission Control Protocol/ Internet Protocol OSI- Open system Interconnect Meaning It is a client server model used for transmission of data over the internet. It is a theoretical model which is used for computing system. No. Of Layers 4 Layers 7 Layers Developed by Department of Defense (DoD) ISO (International Standard Organization) Tangible Yes No Usage Mostly used Never used Q1b) Represent 101011100 using Manchester and Differential Manchester line coding technique. [4] Ans: Manchester Encoding: 1 0 1 0 1 1 1 0 0

bhavanakhivsara.files.wordpress.com · Web viewSubject : Computer Networks Exam: ENDSEM Marks:70 Paper Solution By: Prof. B.A.Khivsara Q1 a) Differentiate between OSI and] : OSI Model

Embed Size (px)

Citation preview

Class: TE Computers Academic Year: 2017-18 SEM:- IISubject : Computer Networks Exam: ENDSEM Marks:70 Paper Solution By: Prof. B.A.Khivsara

Q1 a) Differentiate between OSI and TCP/IP Model [4]

Ans:

Basis for Comparison

TCP/IP Model OSI Model

Expands To TCP/IP- Transmission Control Protocol/ Internet Protocol

OSI- Open system Interconnect

Meaning It is a client server model used for transmission of data over the internet.

It is a theoretical model which is used for computing system.

No. Of Layers 4 Layers 7 LayersDeveloped by Department of Defense (DoD) ISO (International Standard

Organization)Tangible Yes NoUsage Mostly used Never used

Q1b) Represent 101011100 using Manchester and Differential Manchester line coding technique. [4]

Ans:

Manchester Encoding:

1 0 1 0 1 1 1 0 0

Class: TE Computers Academic Year: 2017-18 SEM:- IISubject : Computer Networks Exam: ENDSEM Marks:70 Paper Solution By: Prof. B.A.Khivsara

Differential Manchester Encoding:

Q 1c) Draw flowchart for CSMA/CA [2]

1 0 0 1 1 01 10

Class: TE Computers Academic Year: 2017-18 SEM:- IISubject : Computer Networks Exam: ENDSEM Marks:70 Paper Solution By: Prof. B.A.Khivsara

Q2a) Explain in brief FHSS and DSSS [6]

Ans:

Frequency Hopping Spread Spectrum (FHSS):

Signal is broadcast over seemingly random series of radio frequencies

Signal hops from frequency to frequency at fixed intervals

Receiver, hopping between frequencies in synchronization with transmitter, picks up message

Advantages

Efficient utilization of available bandwidth

Eavesdropper hear only unintelligible blips

Attempts to jam signal on one frequency succeed only at knocking out a few bits

Direct Sequence Spread Spectrum (DSSS):

Each bit in original signal is represented by multiple bits in the transmitted signal

Spreading code spreads signal across a wider frequency band

DSSS is the only physical layer specified for the 802.11b specification

802.11a and 802.11b differ in use of chipping method

802.11a uses 11-bit barker chip

802.11b uses 8-bit complimentary code keying (CCK) algorithm

Class: TE Computers Academic Year: 2017-18 SEM:- IISubject : Computer Networks Exam: ENDSEM Marks:70 Paper Solution By: Prof. B.A.Khivsara

Q2b) Explain fiber optic modes of propagation [4]

Ans:

Light travels through the optical media by the way of total internal reflection. Modulation scheme used is intensity modulation.

Two types of Fiber media :

i. Multimode- Many pulses of light generated by LED travel at different angles Step Index Graded Index

ii. Single mode- Carries light pulses along single path. It Uses Laser Light Source

Multimode Fiber can support less bandwidth than Singlemode Fiber. Singlemode Fiber has a very small core and carry only one beam of light. It can support Gbps data rates over > 100 Km without using repeaters.

Class: TE Computers Academic Year: 2017-18 SEM:- IISubject : Computer Networks Exam: ENDSEM Marks:70 Paper Solution By: Prof. B.A.Khivsara

Q3a) Explain control field of HDLC w.r.t. I-frame,S-frame and U-frame. [6]

Ans:

There are three frame formats in HDLC: I-frame,S-frame and U-frame. Their control fields differs with each other.

Control field format for the different frame types

Control Field for I-Frames:

I-frames are designed to carry user data from the network layer. In addition, they can include flow and error control information (piggybacking). The subfields in the control field are used to define these functions.

1. The first bit defines the type. If the first bit of the control field is 0, this means the frame is an I-frame.

2. The next 3 bits, called N(S), define the sequence number of the frame. Note that with 3 bits, we can define a sequence number between 0 and 7

3. The last 3 bits, called N(R), correspond to the acknowledgment number when piggybacking is used.

4. The single bit between N(S) and N(R) is called the P/F bit. The P/F field is a single bit with a dual purpose. It has meaning only when it is set (bit = 1) and can mean poll or final. It means poll when the frame is sent by a primary station to a secondary (when the address field contains the address of the receiver). It means final when the frame is sent by a secondary to a primary (when the address field contains the address of the sender).

Control Field for S-Frames:

Supervisory frames are used for flow and error control .

1. If the first 2 bits of the control field is 10, this means the frame is an S-frame.

2. The last 3 bits, called N(R), corresponds to the acknowledgment number (ACK) or negative acknowledgment number (NAK) depending on the type of S-frame.

3. The 2 bits called code is used to define the type of S-frame itself. With 2 bits, we can have four types of S-frames, as described below:

Class: TE Computers Academic Year: 2017-18 SEM:- IISubject : Computer Networks Exam: ENDSEM Marks:70 Paper Solution By: Prof. B.A.Khivsara

Receive ready (RR),. Receive not ready (RNR),. Reject (REJ), Selective reject (SREJ)

Control Field for U-Frames:

Unnumbered frames are used to exchange session management and control information between connected devices. Unlike S-frames, U-frames contain an information field, but one used for system management information, not user data. U-frame codes are divided into two sections: a 2-bit prefix before the P/F bit and a 3-bit suffix after the P/F bit. Together, these two segments (5 bits) can be used to create up to 32 different types of U-frames.

Q3b) A Slotted ALOHA network transmits 200-bit frames using a shared channel with a 200-kbps bandwidth. Find the throughput if the system (All stations together) produces [4]

i. 1000 frames per secondii. 500 frames per second

Ans:

The throughput for pure ALOHA is S = G x e-2G 

The throughput is maximum , when G = 1/2 , which is Smax = 0.184 .

Transmission time of frame = 200 bits / 200 kbps = 1ms 

i. Now, system as taken altogether produces 1000 frames per sec i.e , 1 frame per ms which is double the load factor of transmission. Now, as load factor G = 1. In this case S = G x e-2G or S =0.135(135percent). This means S=G×e2G or S=0.135(13.5percent).This means that the throughput is 1000 × 0.135 = 135 frames.

i. Now, system as taken altogether produces 500 frames per sec i.e , 1/2 frame per ms which is load factor of transmission. Now, as load factor G = 1/2 , then throughput is maximum for pure aloha . Hence, 0.184 is throughput. This means that the throughput is 500 × 0.184 = 92 frames.

Q4a) Explain selective repeat ARQ in detail. [5]

Ans: For noisy links, there is another mechanism that does not resend N frames when just one frame is damaged; only the damaged frame is resent. This mechanism is called Selective Repeat ARQ. It is more efficient for noisy links, but the processing at the receiver is more complex.

Windows:

The Selective Repeat Protocol also uses two windows: a send window and a receive window.

Send Window:

Class: TE Computers Academic Year: 2017-18 SEM:- IISubject : Computer Networks Exam: ENDSEM Marks:70 Paper Solution By: Prof. B.A.Khivsara

First, the size of the send window is much smaller; it is 2^m-1. Second, the receive window is the same size as the send window. The send window maximum size can be 2^m-1. For example, if m = 4, the sequence numbers go from 0 to 15, but the size of the window is just 8 (it is 15 in the Go-Back-N Protocol).

Receive window:

The size of the receive window is the same as the size of the send window (2m−1) The Selective Repeat Protocol allows as many frames as the size of the receive window to arrive out

of order and be kept until there is a set of in-order frames to be delivered to the network layer.

The selective repeat protocol can perform following actions

The receiver is capable of sorting the frame in a proper sequence, as it receives the retransmitted frame whose sequence is out of order of the receiving frame.

The sender must be capable of searching the frame for which the NAK has been received. The receiver must contain the buffer to store all the previously received frame on hold till the

retransmitted frame is sorted and placed in a proper sequence. The ACK number, like NAK number, refers to the frame which is lost or damaged. It requires the less window size as compared to go-back-n protocol.

Q4 b) A bit stream 1001101 is transmitted using an hamming code. Show the actual bit string transmitted. Suppose 7th bit from left is inverted during transmission, show that this error is detected and corrected at the receiver’s end. [5]

Ans:

Given bit stream is 1001101

Parity positions are 1,2,4,8. So we mark that bits as Parity bits and other remaining bits will be data bits.

Class: TE Computers Academic Year: 2017-18 SEM:- IISubject : Computer Networks Exam: ENDSEM Marks:70 Paper Solution By: Prof. B.A.Khivsara

Position-> 1 2 3 4 5 6 7Parity/Data bit -> P1 P2 D3 P4 D5 D6 D7Bit Stream-> 1 0 0 1 1 0 1

The Actual bit transmitted is then : 0101

Hamming Code has used Odd Parity.

P1 calculated using positions(1,3,5,7)= 1011

P2 calculated using positions(2,3,6,7)=0001

P4 calculated using positions(4,5,6,7)=1101

If 7th bit is inverted then bit stream will be-> 1001100

P1 calculated using positions(1,3,5,7)= 1010 (it’s not odd parity, so error is detected)

P2 calculated using positions(2,3,6,7)=0000 (it’s not odd parity, so error is detected)

P4 calculated using positions(4,5,6,7)=1100 (it’s not odd parity, so error is detected)

So we discover that Parity at position 1,2 and 4 are incorrect. By adding this number 1+2+4=7, and that bit position 7 is the location of the bad bit. By inverting the last bit from 0 to 1 error is corrected at receiver’s end.

Q5a) An organization is granted the block 130.34.12.64/26. The organization needs to have four subnets with equal number of addresses in each subnet. What are the subnet addresses and range of addresses for each subnet? [6]

Ans:

No of addresses for whole network are N= 232-26 =26 =64 As 4 subnet has to design so we divide no of address with no of sub networks i.e. 64/4= 16.

That means each network has 16 addresses. New subnet mask will be:

For 4 network 2 bits are required (log2 4 =2) to add to /26 mask, so new mask will be 26+2=28.

Subnetwork

Network range Network Address Broadcast Address

1 130.34.12.64/28- 130.34.12.79/28 130.34.12.64/28 130.34.12.79/282 130.34.12.80/28- 130.34.12.95/28 130.34.12.80/28 130.34.12.95/283 130.34.12.96/28- 130.34.12.111/28 130.34.12.96/28 130.34.12.111/284 130.34.12.112/28- 130.34.12.127/28 130.34.12.112/28 130.34.12.127/28

Class: TE Computers Academic Year: 2017-18 SEM:- IISubject : Computer Networks Exam: ENDSEM Marks:70 Paper Solution By: Prof. B.A.Khivsara

Q5b) What are general techniques to improve quality of service? Explain any one in details. [6]

Ans:

Techniques to improve QoS are:

Buffering

Scheduling

FIFO queue

Priority queuing

Weighted fair queuing

Traffic Shaping

Leaky bucket algorithm

Token bucket algorithm

Traffic Shaping : This is a mechanism to control the amount and the rate of the traffic sent to the network.

Suppose we have a bucket in which we are pouring water in a random order but we have to get water in a fixed rate , for this we will make a hole at the bottom of the bucket. It will ensure that water coming out is in a some fixed rate . And also if bucket will full we will stop pouring in it.The input rate can vary, but the output rate remains constant. Similarly, in networking, a technique called leaky bucket can smooth out bursty traffic. Bursty chunks are stored in the bucket and sent out at an average rate.

A description of the concept of operation of the Leaky Bucket Algorithm as a meter that can be used in either traffic policing or traffic shaping, may be stated as follows:

A fixed capacity bucket, associated with each virtual connection or user, leaks at a fixed rate.

If the bucket is empty, it stops leaking.

Class: TE Computers Academic Year: 2017-18 SEM:- IISubject : Computer Networks Exam: ENDSEM Marks:70 Paper Solution By: Prof. B.A.Khivsara

For a packet to conform, it has to be possible to add a specific amount of water to the bucket: The specific amount added by a conforming packet can be the same for all packets, or can be proportional to the length of the packet.

If this amount of water would cause the bucket to exceed its capacity then the packet does not conform and the water in the bucket is left unchanged.

Q5 c) Draw and explain IPV6 header. Explain the significance of extension header [6]

Ans:

Version (4-bits): It represents the version of Internet Protocol

Traffic Class (8-bits): These 8 bits are divided into two parts. The most significant 6 bits are used for Type of Service & The least significant 2 bits are used for Explicit Congestion Notification (ECN).

Flow Label (20-bits): This label is used to maintain the sequential flow of the packets belonging to a communication. Payload Length (16-bits): This field is used to tell the routers how much information a particular packet contains in its payload.

Fig: IPV6 Header.

Next Header (8-bits): This field is used to indicate either the type of Extension Header.

Hop Limit (8-bits): This field is used to stop packet to loop in the network infinitely. The value of Hop Limit field is decremented by 1 as it passes a link (router/hop). When the field reaches 0 the packet is discarded.

Source Address (128-bits): This field indicates the address of originator of the packet.

Class: TE Computers Academic Year: 2017-18 SEM:- IISubject : Computer Networks Exam: ENDSEM Marks:70 Paper Solution By: Prof. B.A.Khivsara

Destination Address (128-bits): This field provides the address of intended recipient of the packet.

Extension Headers- In IPv6, the Fixed Header contains only that much information which is necessary, avoiding those information which is either not required or is rarely used. All such information is put between the Fixed Header and the Upper layer header in the form of Extension Headers. Each Extension Header is identified by a distinct value.

Q6 a) A host with IP address 130.23.3.20 and Physical address B23455102210 has a packet to send to another host with IP address 130.23.43.25 and physical address A46EF45983AB. The two hosts are on the same Ethernet network. Show the ARP request and reply [packets encapsulated o=in Ethernet frames. [4]

Ans:

Figure below shows the ARP request and reply packets. Note that the ARP data field in this case is 28 bytes, and that the individual addresses do not fit in the 4-byte boundary. That is why we do not show the regular 4-byte boundaries for these addresses. Note that we use hexadecimal for every field except the IP addresses.

Class: TE Computers Academic Year: 2017-18 SEM:- IISubject : Computer Networks Exam: ENDSEM Marks:70 Paper Solution By: Prof. B.A.Khivsara

Q6b) Write short note on i)NAT ii)ICMP [8]

Ans:

i) NAT –Network Address Translation:

Network address translation (NAT) is a method of remapping one IP address space into another by modifying network address information in IP header of packets while they are in transit across a traffic routing device.[1] The technique was originally used as a shortcut to avoid the need to readdress every host when a network was moved. It has become a popular and essential tool in conserving global address space in the face of IPv4 address exhaustion. One Internet-routable IP address of a NAT gateway can be used for an entire private network.

In following example router is NAT router with address 200.24.5.8. When any packet goes from private network to internet, the source address of packet is replaced with NAT router address. As shown in Fig B.

Fig A.: Implementation of NAT

Fig B: Address in NAT

ii)ICMP- Internet Control Message Protocol:

The IP protocol has no error-reporting or error correcting mechanism. What happens if something goes wrong? What happens if a router must discard a datagram because it cannot find a router to the final

Class: TE Computers Academic Year: 2017-18 SEM:- IISubject : Computer Networks Exam: ENDSEM Marks:70 Paper Solution By: Prof. B.A.Khivsara

destination, or Because the time-to-live field has a zero value? These are examples of situations where an error has occurred and the IP protocol has no built-in mechanism to notify the original host.

The solution is ICMP protocol

ICMP messages are divided into two broad categories:

1. error-reporting messages 2. query messages.

The error-reporting messages report problems that a router or a host (destination) may encounter when it processes an IP packet.

The query messages, help a host or a network manager get specific information from a router or another host. Also, hosts can discover and learn about routers on their network and routers can help a node redirect its messages.

Q6c) Explain Distance Vector Routing Algorithm? Consider topology given in fig(a) and vectors received from router J’s four neighbours are given infig(b). calculate new routing table for router J using Distance vector Routing algorithm. [6]

Ans:

Distance Vector Routing Algorithm:

A distance-vector routing protocol in data networks determines the best route for data packets based on distance. Distance-vector routing protocols measure the distance by the number of routers a packet has to pass, one router counts as one hop. Some distance-vector protocols also take into account network latency and other factors that influence traffic on a given route.

Class: TE Computers Academic Year: 2017-18 SEM:- IISubject : Computer Networks Exam: ENDSEM Marks:70 Paper Solution By: Prof. B.A.Khivsara

To determine the best route across a network routers on which a distance-vector protocol is implemented exchange information with one another, usually routing tables plus hop counts for destination networks and possibly other traffic information.

Distance-vector routing protocols also require that a router informs its neighbours of network topology changes periodically.

Distance-vector routing protocols use the Bellman–Ford algorithm to calculate the best route. The term distance vector refers to the fact that the protocol manipulates vectors (arrays) of distances to other nodes in the network.

(a) (b)

To calculate the distance from J to A, we have 4 routes

1. J to A direct with cost 92. J to A via I with cost= J to I(10) + I to A(21)= 313. J to A via H with cost= J to H(12) + H to A(20)= 304. J to A via K with cost= J to K(6) + K to A(21)= 27

From all 4 options the first options have lowest cost, so we add entry in J’s table for A with cost 8 using direct path. Same like this way, we will calculate for all routers distance from J’s and build the J’s routing table with minimum cost as shown below.

Class: TE Computers Academic Year: 2017-18 SEM:- IISubject : Computer Networks Exam: ENDSEM Marks:70 Paper Solution By: Prof. B.A.Khivsara

Q7a) What causes silly window syndrome? How it is avoided? Explain. [4]

Ans:

If the receiver processes data slower than the sender transmits it, eventually the usable window becomes smaller than the maximum segment size (MSS) that the sender is allowed to send. However, since the sender wants to get its data to the receiver as quickly as possible, it immediately sends a smaller packet to match the usable window. As long as the receiver continues to consume data at a slower rate, the usable window, and therefore the transmitted segments, will get smaller and smaller.

Example of such situation is as shown in below Figure.

• There are two solutions

• Nagle’s solution

• Clark’s solution

Nagle’s solution

• Purpose is to allow the sender TCP to make efficient use of the network, while still being responsive

to the sender applications.

• Idea:

• If application data comes in byte by byte, send first byte only. Then buffer all application data till

until ACK for first byte comes in.

• If network is slow and application is fast, the second segment will contain a lot of data.

• Send second segment and buffer all data till ACK for second segment comes in.

• An exception to this rule is to always send (not wait for ACK) if enough data for half the receiver

window or MSS(Maximum segment size) is accumulated.

Class: TE Computers Academic Year: 2017-18 SEM:- IISubject : Computer Networks Exam: ENDSEM Marks:70 Paper Solution By: Prof. B.A.Khivsara

Clark’s solution

• Purpose is to prevent the receiver from sending a window update for 1byte.

• Idea:

• Receiver is forced to wait until it has a decent amount of space available

• The receiver should not send a window update until it can handle the maximum segment size it declared when the connection was established or until its buffer is half empty, whichever is smaller

Q7 b) In a stop-and-wait system, the bandwidth of the line is 2 Mbps, and 1 bit takes 20 milliseconds to make a round trip. What is the bandwidth-delay product? If the system data packets are 2,000 bits in length, what is the utilization percentage of the link?[4]

Ans:

The bandwidth-delay product is 1 ×106×20 10-3= 20,000 bits

The system can send 20,000 bits during the time it takes for the data to go from the sender to the receiver and then back again. However, the system sends only 1000 bits. We can say that the link utilization is only 1000/20,000, or 5%. For this reason, for a link with high bandwidth or long delay, use of Stop-and-Wait ARQ wastes the capacity of the link.

Q7c) For each of the following applications,determine whether TCP or UDP is used as the transport layer protocol and explain the reason(s) for your choice: [8]

i. Watching a real time streamed videoii. Web browsingiii. A voice over IP(VoIP) telephone conversationiv. YouTube video

Ans:

1. Watching a real time streamed video

This should be UDP.The reason is that when watching a movie, delay is critical and therefore there simply isn't any time to seek the retransmission of any errors. The simplicity of UDP is therefore required

2. Web browsing

This should be TCPThe reason is that web pages need to be delivered without error so that all content is properly formatted and presented. Therefore the error detection and correction properties of TCP are needed.

3. A Voice over IP (VoIP) telephone conversation

This should be UDP.The reason is that a telephone conversation has strict timing requirements for the transfer of data and seeking the retransmission of any errors would introduce too much delay. Therefore the simplicity of UDP is needed.

Class: TE Computers Academic Year: 2017-18 SEM:- IISubject : Computer Networks Exam: ENDSEM Marks:70 Paper Solution By: Prof. B.A.Khivsara

4. YouTube Video

This uses TCP.

Video streaming meets with TCP in their nature. First, video streaming adopts pre-fetching and buffering to achieve smooth play-out. TCP provides such (network) buffer, as well as the reliable transmission guarantee for no loss of frame (a frame could still miss the play-out deadline and gets discarded, however).

Second, TCP's bandwidth probing and congestion control will attempt to use all of the available bandwidth between server and client, fetching content as quick as possible while being friendly to other (TCP) traffic on the same links.

Q8a) What are the types of sockets? Explain various socket primitives used in connection oriented client server approach. [8]Ans:

Socket Types

1. Stream Sockets − Delivery in a networked environment is guaranteed. If you send through the

stream socket three items "A, B, C", they will arrive in the same order − "A, B, C". These sockets use

TCP (Transmission Control Protocol) for data transmission.

2. Datagram Sockets − Delivery in a networked environment is not guaranteed. They're

connectionless because you don't need to have an open connection as in Stream Sockets − you build

a packet with the destination information and send it out. They use UDP (User Datagram Protocol).

3. Raw Sockets − These provide users access to the underlying communication protocols, which

support socket abstractions. These sockets are normally datagram oriented, though their exact

characteristics are dependent on the interface provided by the protocol. Raw sockets are not

intended for the general user; they have been provided mainly for those interested in developing

new communication protocols, or for gaining access to some of the more cryptic facilities of an

existing protocol.

Socket primitives

1. Client side primitives:

Create a socket with the socket() system call.

Connect the socket to the address of the server using the connect() system call.

Send and receive data. There are a number of ways to do this, but the simplest way is to use the

read() and write() system calls.

Class: TE Computers Academic Year: 2017-18 SEM:- IISubject : Computer Networks Exam: ENDSEM Marks:70 Paper Solution By: Prof. B.A.Khivsara

2. Server side primitives

Create a socket with the socket() system call.

Bind the socket to an address using the bind() system call. For a server socket on the Internet,

an address consists of a port number on the host machine.

Listen for connections with the listen() system call.

Accept a connection with the accept() system call. This call typically blocks the connection until

a client connects with the server.

Send and receive data using the read() and write() system calls.

Q8b)Explain UDP header? Below is an Hexadecimal dump of an UDP datagram captured.

e2a7000D0020749eff00000001000000000000066973617461700000010001. [8]

i. What is source port number?

ii. What is destination port number?

iii. What is total length of the user datagram?

iv. What is length of the data?

v. Is packet directed from a client to server or vice versa?

Ans:

i. The source port number is the first four hexadecimal digits (e2a7)16 or 58023ii. The destination port number is the second four hexadecimal digits (000D)16 or 13.iii. The third four hexadecimal digits (0020)16 define the length of the whole UDP packet as 32 bytes.iv. The length of the data is the length of the whole packet

minus the length of the header, or 32 – 8 = 24 bytes.v. Since the destination port number is 13 (well-known port), the packet is from the client to the

server. The client process is the Daytime.( port 13 is Daytime process)

Q9a) What is difference between persistent and non-persistent HTTP/ Explain HTTP request and reply message format. [6]

Ans:

Difference between persistent and non-persistent HTTP

Persistent Non-PersistentUses HTTP/1.0 Uses HTTP/1.1Have only 16 status codes Have introduced new 24 status codeProvides only basic authentication Provides strong authenticationUses Non persistent connection Uses Persistent connectionRTT is more so bandwidth waste is vast RTT is less so bandwidth utilization is goodStateless Uses cookies as state management mechanism

Class: TE Computers Academic Year: 2017-18 SEM:- IISubject : Computer Networks Exam: ENDSEM Marks:70 Paper Solution By: Prof. B.A.Khivsara

Supports only GET POST and HEAD method Supports GET, POST, HEAD,PUT and DELETE

HTTP request and reply message format

i. HTTP request Header

Request-Line

A Request-Line consists of method (Get/Post/Put ),the URL of requesting a resource from the server and the HTTP protocol version .

Header Lines

A Header line consists of header field: header value(Example – Content-Type: html)

HTTP response Header

Status-Line

A Status-Line consists of the protocol version followed by a numeric status code and its associated textual phrase. The elements are separated by space SP characters.

Header Lines

A Header line consists of header field: header value(Example – Content-Type: html)

A message body which is optional.

Q9b) Write short note on

i)DHCP

ii)MIME [6]

Ans:

i) DHCP- Dynamic Host Configuration Protocol:

The key word in DHCP is "dynamic." Because instead of having just one fixed and specific IP address, most computers will be assigned one that is available from a subnet or "pool" that is assigned to the network. The Internet isn't one big computer in one big location. It's an interconnected network of networks, all created to make one-on-one connections between any two clients that want to exchange information.

Class: TE Computers Academic Year: 2017-18 SEM:- IISubject : Computer Networks Exam: ENDSEM Marks:70 Paper Solution By: Prof. B.A.Khivsara

One of the features of DHCP is that it provides IP addresses that "expire." When DHCP assigns an IP address, it actually leases that connection identifier to the user's computer for a specific amount of time. The default lease is five days.

Here is how the DHCP process works when you go online:

1. Your go on your computer to connect to the Internet.2. The network requests an IP address (this is actually referred to as a DHCP discover message).3. On behalf of your computer's request, the DHCP server allocates (leases) to your computer an IP

address. This is referred to as the DHCP offer message.4. Your computer (remember—you're the DHCP client) takes the first IP address offer that comes

along. It then responds with a DHCP request message that verifies the IP address that's been offered and accepted.

5. DHCP then updates the appropriate network servers with the IP address and other configuration information for your computer.

6. Your computer (or whatever network device you're using) accepts the IP address for the lease term.

ii)MIME : Multipurpose Internet Mail Extensions

MIME stands for (Multipurpose Internet Mail Extensions). It is widely used internet standard for coding binary files to send them as e-mail attachments over the internet. MIME allows an E-mail message to contain a non-ASCII file such as a video image or a sound and it provides a mechanism to transfer a non text characters to text characters.

MIME was invented to overcome the following limitations of SMTP:

1. SMTP cannot transfer executable files and binary objects.

2. SMTP cannot transmit text data of other language, e.g. French, Japanese, Chinese

3. SMTP cannot handle non-textual data such as pictures, images, and video/audio content.

MIME Header

The five header fields defined in MIME are as follows:

Class: TE Computers Academic Year: 2017-18 SEM:- IISubject : Computer Networks Exam: ENDSEM Marks:70 Paper Solution By: Prof. B.A.Khivsara

1. MIME-version. It indicates the MIME version being used. The current version is 1.1. It is represented as :

MIME-version: 1.1.

2. Content-type. It describes the type and subtype of the data in the body of the message.

3. Content-transfer encoding. It describes how the object within the body has been encoded to US ASCII

to make it acceptable for mail transfer. 

4. Content-Id. It is used to uniquely identify the MIME entities in multiple contexts i.e. it uniquely identifies

the whole message in a multiple message environment.

5. Content-description. It is a plaintext description of the object within the body; It specifies whether the

body is image, audio or video.

Q9 c) Explain DNS message format? [4]

Ans:

DNS Messages

The DNS protocol uses a common message format for all exchanges between client and server or between servers. The DNS messages are encapsulated over UDP or TCP using the "well-known port number" 53. DNS uses UDP for message smaller than 512 bytes (common requests and responses).

DNS Message

Identification Control

Question count Answer count

Authority count Additional count

Question

...

Answer

...

Authority

...

Additional

...

Identification.  16 bit field used by the client to match the response with the query. The client uses ientification number each time it sends a query. The server duplicates this number in response.

Control- 16 bit field consisting of other subfields. Question Count- . This is a16-bit field consisting of number of queries in question section of

message.

Class: TE Computers Academic Year: 2017-18 SEM:- IISubject : Computer Networks Exam: ENDSEM Marks:70 Paper Solution By: Prof. B.A.Khivsara

Answer Count- This is a 16-bit field containing the number of answer records in the answer section of response message. Its value is 0in the query message.

Authority count- A sixteen bit field which tells the number of authoritative records in the authoritative section of the response message. Its value is zero in the query message.

Additional count- This is a 16 bit fieldcontaining the number of additional recordsin the additional section of the response message.

Question Section This is a section consisting of one or more question records. It is present on both query and response messages

Answer SectionThis is section consisting of one or more resource records. It is present only in response messages. This section includes answer from the server to the client (resolver).

Authoritative Section This section is also contained only in response messages of DNS, and gives information about domain names regarding authoritative servers for the query.

Additional Information Section This section provides additional information to help the resolver and present only in response part of DNS message format.

Q10 a) Explain FTP? Can we specify file transfer in a Web page? Explain with the help of suitable example. [8]Ans:

FTP:- File Transfer Protocol.

Allow file sharing between remote machine Transfer data reliably and efficiently FTP Protocol falls within client server model Both client & server have 2 process allowing information (Data & command) to be managed , they

are1. DTP(Data transfer Process)2. PI(Protocol Interpreter)

FTP client contacts FTP server at port 21 Client authorized over control connection

Class: TE Computers Academic Year: 2017-18 SEM:- IISubject : Computer Networks Exam: ENDSEM Marks:70 Paper Solution By: Prof. B.A.Khivsara

Client browses remote directory by sending commands over control connection. when server receives file transfer command, server opens 2nd TCP connection (for file) to client After transferring one file, server closes data connection. FTP server maintains “state”: current directory, earlier authentication

File transfer in a Web page -Today’s web browsers allow you to transfer, download files via FTP from within the browser window.

Example- You can use a web browser to connect to FTP addresses exactly as you would to connect to HTTP addresses. Using a web browser for FTP transfers makes it easy for you to browse large directories and read and retrieve files. Your web browser will also take care of some of the details of connecting to a site and transferring files. While this method is convenient, web browsers are often slower and less reliable and have fewer features than dedicated FTP clients.

To use your web browser to connect to an FTP site such as ftp.empire.gov, where you normally enter a URL, enter: ftp://ftp.empire.gov/

Q10 b) Browser have a in-build caching mechanism for a better user experience. How do websites indicate if a web resource needs to be cached or not? Show HTTP messages for both scenarios. [8]Ans: Cache-Control

Each resource can define its caching policy via the Cache-Control HTTP header. Cache-Control directives control who can cache the response, under which conditions, and for how

long.

From a performance optimization perspective, the best request is a request that doesn't need to communicate with the server: a local copy of the response allows you to eliminate all network latency and avoid data charges for the data transfer. To achieve this, the HTTP specification allows the server to return Cache-Control directives that control how, and for how long, the browser and other intermediate caches can cache the individual response.

Note: The Cache-Control header was defined as part of the HTTP/1.1 specification and supersedes previous headers (for example, Expires) used to define response caching policies. All modern browsers support Cache-Control, so that's all you need.

Class: TE Computers Academic Year: 2017-18 SEM:- IISubject : Computer Networks Exam: ENDSEM Marks:70 Paper Solution By: Prof. B.A.Khivsara

"no-cache" and "no-store"

"no-cache" indicates that the returned response can't be used to satisfy a subsequent request to the same URL without first checking with the server if the response has changed. As a result, if a proper validation token (ETag) is present, no-cache incurs a roundtrip to validate the cached response, but can eliminate the download if the resource has not changed.

By contrast, "no-store" is much simpler. It simply disallows the browser and all intermediate caches from storing any version of the returned response—for example, one containing private personal or banking data. Every time the user requests this asset, a request is sent to the server and a full response is downloaded.