Vous êtes sur la page 1sur 21

CS6651-Computer Networks 1.

Define computer network.


Computer network is a connection of autonomous computers and network devices for:
 Resource sharing (data/devices) in an efficient manner
 Communication amongst them.
Compare simplex and duplex communication with example.
 Simplex—communication is unidirectional (eg. keyboard, monitor).
 Half-duplex—Can transmit and receive, but not simultaneously (eg. walkie-talkie)
 Full-duplex—Can transmit and receive simultaneously (eg. telephone network).

What are the two types of line configuration?


 A point-to-point connection provides a dedicated link between two nodes.
 In a multipoint, more than two nodes share a single link, i.e., bandwidth is shared.

State any two topologies in which a network can be organized.

Mesh Star Bus Ring


 Mesh—Each device has a dedicated point-to-point link to every other device. It is robust
and secure. Installation is difficult and expensive n(n-1) link for n nodes.
 Star−Each device has a dedicated point-to-point link to the hub. All communication goes
via the hub. It is less expensive and robust. If hub fails, then the network non-functional.
 Bus—It is multi-point and signal gets weak as it travels through the long cable that acts as
backbone. A fault in the bus stops the entire transmission
 Ring—Each device has a dedicated point-to-point connection with the devices on either
side of it. A break in the ring can disable the entire network due to unidirectional traffic.
Classify LAN, WAN, MAN, SAN and Internetwork.
 Local Area Network (LAN)−is a private network in an office, building, or campus. LAN
size is limited to a few kilometers. The speed of LAN is in range 10–1000 Mbps.

Vijai Anand cseannauniv.blogspot.in


CS6651-Computer Networks 1.2

 Wide Area Network (WAN)—provides long-distance transmission of data, image, audio,


and video over large geographic areas that may comprise a country / continent.
 Metropolitan Area Network (MAN)—is a network with size between LAN and WAN. It
is designed for high-speed connectivity to Internet, with endpoints spread over a city.
 When two or more networks are connected, it is known as internetwork or internet.
 Storage area network (SAN)—is confined to a single room and used to connect various
components of a high-performance computing system to storage servers.
List the advantages of layering.
 Decomposes the problem of building a network into more manageable components.
 Provides a more modular design. To add a new service, then it is only needed to modify
the functionality at one layer, reusing the functions at all the other layers.
 Uses abstraction to hide complexity of network from application.
Define protocol.
 Abstract objects that make up the layers of a network system are called protocols.
 Protocol is a set of rules that govern communications between devices.
 Each protocol defines two different interfaces.
o Service interface that specifies the set of operations
o Peer-to-peer interface for messages to be exchanged amongst peers
What is a protocol graph?
 Suite of protocols that make up a network system is represented as a protocol graph.
 Nodes correspond to protocols and edges represent a depends-on relation in the graph.

Discuss the requirements for building a computer network.


1. Perspectives
 Application programmer—list the services based on application needs. For example, a
guarantee that each message will be delivered without error or within a certain time.
 Network operator—lists the characteristics of a system that is easy to administer and
manage. For example, fault isolation, adding new devices, easy to account for usage, etc.
 Network designer—lists the properties of a cost-effective design. For example, efficient
utilization of network resources, fair allocation to users, etc.
2. Scalable Connectivity
 A system that is designed to support growth to an arbitrarily large size is scalable.
 End nodes can be connected through a set of forwarding nodes called switches to build
networks. Switching could be either circuit or packet switching.
 Each node on the network is assigned a unique address.
 Packet switching networks uses store-and-forward method, i.e. the switch receives a
packet, stores in its buffer and later forwards onto another link.
 Independent networks are connected to form internetwork or internet. A node that
connects two or more networks is known as router.
 Process of forwarding message from source to destination is known as routing. Messages
may be unicasted, multicasted or broadcasted.

Vijai Anand cseannauniv.blogspot.in


CS6651-Computer Networks 1.3

3. Cost-Effective Resource Sharing


 Hosts share network resources using the concept of multiplexing. For example, multiple
flows can be multiplexed onto a single physical link using FDM / TDM.
 Synchronous time-division multiplexing (STDM) divides time into equal slots and flows
use the slots in a round-robin manner.
 Statistical multiplexing is same as STDM but packets are transmitted from each flow on
demand, rather than on predetermined slot.
 Packets multiplexed at one end, is demultiplexed at the other switch.
 Switch process the packets queued up using queuing discipline such as FIFO.

4. Support for Common Services


 Since applications have common services, network must provide logical channels and set
of services such as guaranteed delivery, in-order delivery, privacy, etc.
 Two types of communication channels provided are request/reply and message stream.
 Request/reply channel guarantees delivery of message and ensures privacy and integrity
of data required in case of FTP or digital library.
 Message stream channel does not guarantee delivery of all data but assures in-order
delivery, required in applications like video conferencing.
5. Manageability
 Network needs troubleshooting to adapt to increase in traffic or to improve performance.
 Automating network management tasks is needed for scalability and cost-effectiveness.
 Network nowadays is common and should be managed by consumers with less skill level

Vijai Anand cseannauniv.blogspot.in


CS6651-Computer Networks 1.4

Define network architecture.


 Set of rules governing form and content of protocol graph is called network architecture.
 Network architecture guides the design and implementation of computer networks.
 Two commonly used architecture are
o OSI Architecture
o Internet or TCP/IP architecture
What purpose do header and trailer serve?
 A layer communicates control information to its peer, instructing it how to handle the
message when it is received by attaching a header in front of the message.
 Trailer usually contains error control information.
 A header/trailer is a small data structure consists of a few bytes.
Brief the terms unicast, multicast and broadcast.
 The different types of addressing are:
o unicast (one-to-one communication),
o multicast (communicating to all members of a group) and
o broadcast (sending to all nodes on the network).

What is encapsulation?
 As data passes through a layer, it attaches its header and then passes it to the next layer.
 For the next layer, the data and header of the previous layer is encapsulated as a unit.
 It then attaches its header and passes to the next layer and so on.
Discuss in detail the layers of OSI model with a neat diagram (or) Layering and Protocol .
 ISO defines a common way to connect computers, called Open Systems Interconnection
(OSI) architecture. (eg. public X.25 network).
 OSI partitions network functionality into seven layers namely: Physical, Data Link,
Network, Transport, Session, Presentation and Application.
 Bottom three layers are implemented on all nodes in the network including switches.

Vijai Anand cseannauniv.blogspot.in


CS6651-Computer Networks 1.5

1. Physical Layer
 It coordinates the functions required to carry a bit stream over a physical medium.
 Encoding—Bits are encoded into signals (electrical or optical) for transmission.
 Data rate—Defines the transmission rate (number of bits sent per second).
 Physical topology—How devices are connected (mesh, star, ring, bus or hybrid)
 Transmission mode—Direction of transmission (simplex or duplex).

2. Data Link Layer


 The data link layer transforms a raw transmission facility to a reliable link.
 Framing—Bit stream is divided into manageable data units called frames.
 Physical addressing—Header contains physical address of sender and receiver
 Flow control—mechanism that avoids sender overwhelming the receiver with frames.
 Error control—Redundant information is put as trailer to detect corrupt frames.
 Access control—Protocol that determines which device has control over the shared link.

3. Network Layer
 It is responsible for source-to-destination delivery of a data unit called packet.
 Logical addressing—A packet is identified across the network using logical addressing
provided by network layer and is used to identify the end systems.
 Routing—Routers prepare routing table to send packets to their destination.

4. Transport Layer
 Transport layer is responsible for process-to-process delivery of the entire message.
 Port addressing—Processes communicates with each other using through ports.
 Segmentation and reassembly—A message is divided into transmittable segments, with a
sequence number. Segments belonging to a message are reassembled at the other end.
 Connection control—Protocols can be either connectionless or connection-oriented.

5. Session Layer
 It establishes, maintains, and synchronizes interaction among communicating systems.
 Dialog control—Enables two systems to enter into a dialog and communicate
 Synchronization—Adds checkpoints to a stream of data, used when system crashes.
 Binding—Binds different streams (audio & video stream in videoconference application).
6. Presentation Layer
 It is concerned with syntax and semantics of information exchanged between peers.
 Translation—Facilitates interoperability when end nodes use different encoding systems.
 Encryption—Ensures privacy by encrypting the message before sending.
 Compression—Data compression reduces bandwidth requirements (eg. Multimedia).

Vijai Anand cseannauniv.blogspot.in


CS6651-Computer Networks 1.6

7. Application Layer
 Enables the user, whether human or software, to access the network.
 Provides user interface and support for services such as electronic mail, remote file
access, shared database management and several types of distributed services.
 Composes a host of application protocols such as HTTP, FTP, SMTP, etc.

Explain the layers of TCP/IP (or) Internet architecture in detail.

Features
 Internet architecture is a four layered model, also known as TCP/IP architecture.
 It evolved out of a packet-switched network called ARPANET.
 TCP/IP does not enforce strict layering, i.e., applications are free to bypass transport
layer and can directly use IP or any of the underlying networks.
 IP layer serves as focal point in the architecture.
o Defines a common method for exchanging packets to any type of network
o Segregates host-to-host delivery from process-to-process delivery.
 Protocol can be added, if it provides at least one working implementation.
Layers
 Subnetwork―TCP/IP does not define any specific protocol for the lowest level.
o All standard and proprietary protocols such as Ethernet, FDDI, etc are supported.
o The protocols are generally implemented by a combination of hardware/software.
 IP―The major protocol in TCP/IP is Internetworking Protocol (IP).
o It supports the interconnection of multiple networking technologies into a logical
internetwork.
o It is an unreliable and connectionless protocol.
o IP sends data in packets called datagrams, each of which is transported separately
and independently.
o Other protocols supported in this layer are ARP, RARP, ICMP and IGMP.
 Transport layer is responsible for delivery of a message from one process to another
process. The two protocols supported in this layer are:
o Transmission Control Protocol (TCP) for connection-oriented reliable byte-
stream channel.
o User Datagram Protocol (UDP) for connectionless unreliable datagram delivery
channel.
 Application―supports a wide range of protocols such as FTP, TFTP, Telnet (remote
login), SMTP, etc., that enables the interoperation of popular applications.

Vijai Anand cseannauniv.blogspot.in


CS6651-Computer Networks 1.7

Briefly explain the socket API for implementing network application.


 Network protocols are part of operating system and interface provided is known as
network application programming interface (API).
 Network APIs provide syntax through which protocol services are invoked.
 Unix socket interface is widely used. Socket is an endpoint on the communication link
between applications running on the network.
 Operations defined are socket creation, binding socket to network, send / receive
messages and finally close the socket.
Socket Creation
 Socket is created using socket interface. A handle is returned on successful creation.
socket ( domain, type, protocol )
o domain argument specifies protocol family (PF_INET for Internet family,
PF_PACKET for direct access to network, etc)
o type argument specifies stream (SOCK_STREAM for byte stream, SOCK_DGRAM
for message-oriented service, SOCK_RAW for raw sockets)
o protocol argument specifies the protocol used (default value 0).
Server Process
 Server processes perform passive open, i.e., it waits for client requests by invoking the
following operations:
bind ( socket, address, addr_len )
listen (socket, backlog )
accept ( socket, address, addr_len )
o bind operation attaches the socket to server host's IP address and port. Server port
number is well-known, i.e., 0–1024 (for example, web servers use port 80).
o listen operation specifies number of pending connections.
o accept operation blocks until a client establishes connection
Client Process
 Client processes perform active open, i.e., it establishes connection with the server using
connect operation.
connect ( socket, address, addr_len )
 Client knows the remote server's logical address and port number and lets the system fill
in detail such as client IP address and ephemeral port number.
Communication
 Communication between server and client process takes place after connection
establishment using send and recv operation.
send ( socket, message, msg_len, flags )
recv ( socket, message, msg_len, flags )
o send operation is used to send message over the socket and recv operation is used
to store the message received over the socket onto a buffer.

Vijai Anand cseannauniv.blogspot.in


CS6651-Computer Networks 1.8

Discuss the factors that affect performance of the network.


1. Bandwidth and Latency
 Bandwidth refers to number of bits that can be transmitted over the network within a
certain period of time (throughput).
 Bandwidth also determines how long it takes to transmit each bit. For example, each bit
on a 1-Mbps link is 1µs wide, whereas each bit on a 2-Mbps link is 0.5µs wide.

 Latency refers to how long it takes for the message to travel to the other end (delay). It is
a factor of propagation delay, transmission time and queuing delay
Latency = Propagation + Transmit + Queue
 Speed of light propagation depends on medium and distance.
Propagation = Distance / SpeedOfLight
 Transmission time depends upon bandwidth and packet size.
Transmit = Size / Bandwidth
 Queuing delay occurs at switches and routers, since packets are stored before forwarded.
 For applications that have minimal data transfer, latency dominates performance, whereas
for bulk data transfers, bandwidth dominates performance.
2. Delay × Bandwidth Product

 Consider a pipe, in which bandwidth is diameter and delay corresponds to length.


 Delay × bandwidth product specifies the number of bits in transit. It corresponds to how
much the sender should transmit before the first bit is received at the other end.
 For example, for a cross-country fiber with 10 Gbps bandwidth, distance of 4000 km, the
RTT is 40 ms and RTT × bandwidth is 400 Mb.
3. High Speed Networks
 High speed networks enhances the bandwidth for applications but latency remains fixed.
 For example, when a 1 MB file is transmitted over a 1 Mbps link takes 80 RTTs, whereas
the same file over a 1 Gbps links falls short of 1 RTT.
 Effective end-to-end throughput that can be achieved is given as
Throughput = TransferSize / TransferTime
 TransferTime includes latency as well as setup time.
4. Application Performance Needs
 Applications generally require as much bandwidth provided by the network.
 Average bandwidth of flow rates could be estimated, but instantaneous bursty traffic
should also be handled.
 Latency varying from packet to packet is known as jitter. If receiver knows the latency
that video packets may experience, then it delays playing first frame.

Vijai Anand cseannauniv.blogspot.in


CS6651-Computer Networks 1.9

Explain how framing is done using bit and byte oriented protocols.
 Data link layer partitions message into smaller units called frames. When an error occurs,
it affects only that small frame.
 Frame contains header (physical address of sender and destination), data and trailer (error
control information). Frame length can be either fixed or variable.
1. Binary Synchronous Communication (BISYNC) protocol
 BISYNC protocol is byte-oriented and uses sentinel approach.

 SYN―special synchronization bits indicating beginning of the frame


 SOH―special sentinel character that indicates start of header
 Header―contains physical address of source, destination and other information
 STX―special sentinel character that indicates start of text/body
 ETX―special sentinel character that indicates end of text/body
 CRC―16-bit CRC code used to detect transmission error
Character stuffing
 In sentinel approach, it is possible that ETX character might appear in the data.
 In such case, ETX is preceded with a DLE (data-link-escape) character.
 If the data contains escape character, then it is preceded by another DLE.
 Insertion of DLE character onto the data is known as character stuffing.
 Receiver removes the stuffed DLE characters and correctly interprets the frame.
 If ETX field is corrupted, then it is known as framing error. Such frames are discarded.

2. Digital Data Communication Message Protocol (DDCMP)


 DDCMP is byte-oriented and uses counting approach.

 Count field specifies how many bytes are contained in the frame’s body.
 If Count field is corrupted, then it is known as framing error and is discarded.

Vijai Anand cseannauniv.blogspot.in


CS6651-Computer Networks 1.10

3. Point-to-Point Protocol (PPP)

 PPP is byte-oriented and used to carry IP packets over point-to-point links.


 PPP uses sentinel and employs character stuffing.
 Flag field contains special character 01111110.
 Protocol field is used for multiplexing.
 Body (data) is 1500 bytes by default.
4. High-Level Data Link Control (HDLC) Protocol
 HDLC is bit-oriented protocol and views frame as a collection of bits. The frame format

 Frame beginning and end contains a special bit sequence 01111110


Bit Stuffing
 To prevent occurrence of bit pattern 01111110 as part of frame body, bit stuffing is used.
 If a 0 and five consecutive 1 bits are encountered, sender adds an extra 0.
 This extra stuffed bit is eventually removed from the data by the receiver.
 The real flag 01111110 is not stuffed by the sender.
 If a bit such as 01111111 arrives, then an error has occurred and the frame is discarded.

5. Synchronous Optical Network (SONET)


 SONET standard is clock-based framing of fixed size.
 Runs on the carrier's optical network and offers rich set of services.
 Lowest speed SONET link STS-1 frame consist of 9 rows with 90 bytes each row.

 First 2 bytes of the frame contain a special bit pattern indicating start of frame.
 First 3 bytes of each row are overhead and rest containing data.
 Bit stuffing is not employed here
 Receiver looks for the special bit pattern every 810 bytes. If not, the frame is discarded.

Vijai Anand cseannauniv.blogspot.in


CS6651-Computer Networks 1.11

 Overhead bytes of a SONET frame are encoded using NRZ encoding.


 SONET supports the multiplexing of multiple low-speed links. The links range from
51.84 Mbps (STS-1) to 2488.32 Mbps (STS-48).
 STS-1 frame is 810 bytes long with speed 51.84 Mbps, whereas STS-3 frame is 2430
bytes long at rate 155.52 Mbps.
 STS-N signal can being used to multiplex N STS-1 frames. The payload from STS-1
frames are linked together to form a STS-N payload, denoted as STS-Nc.

How errors are introduced in the data?


 Bit errors are introduced into frames because of electrical interference or thermal noise.
 This interference can change the shape of the signal, i.e. bit inversion.
List the types of error with an example.
 The two types of error are single-bit error and burst error
 Single-bit error means that only 1 bit of a given data unit is changed. Single-bit errors are
the least likely type of error in serial data transmission.

 Burst error means that 2 or more bits in the data unit have changed

Differentiate error detection and error correction.


 Error detection—Receiver uses redundant information to detect whether the received data
contains error or not. If an error is detected, the data is discarded and sender retransmits.
Methods are Two dimensional parity, Internet checksum, CRC
 Error correction—Receiver uses the redundant bits to determine which bits are corrupted
and original data is restored by the receiver. No retransmission is required. Methods are
Hamming code, Reed Solomon, etc.
Explain error detection methods in detail with example
 Error detection is only to see if data is corrupted or not. A single-bit or burst error is
immaterial.
 Sender adds k redundant bits for n data bits (k << n) to a frame, which is used by the
receiver to determine if errors are there or not.

Vijai Anand cseannauniv.blogspot.in


CS6651-Computer Networks 1.12

1. Two-Dimensional Parity
 Data is divided into rows of 7 bits each.
 Even parity is computed for each row (Vertical Redundancy Check).
 Even parity is also computed for each column (Longitudinal Redundancy Check).
 Thus a parity byte for the entire frame, in addition to a parity bit for each byte is sent.
Data : 1100111 1011101 0111001 0101001
1 1 0 0 1 1 1 1

Row Parities
1 0 1 1 1 0 1 1
0 1 1 1 0 0 1 0
0 1 0 1 0 0 1 1
0 1 0 1 0 0 1 1 Column Parities
Transmitted Data : 11001111 10111011 01110010 01010011 01010011
 Receiver computes row and column parities for data bits. If all parity bits and parity byte
match, then the frame is accepted else discarded.
 Two-dimensional parity catches all 1, 2 and 3-bit errors, and most 4-bit errors.
2. Internet Checksum
 16-bit Internet checksum is widely used by UDP and not in data link layer.
Sender
 Given data is divided into 16-bit words.
 All words are added using one's complement arithmetic.
 Carries (if any) are wrapped and added to the sum.
 Complement of sum is known as checksum and is sent with data
Receiver
 All words including checksum are added using one's complement addition.
 The sum is complemented and becomes the new checksum.
 If the value of checksum is 0, the message is accepted, otherwise it is rejected.
7 0111 7 0111
11  1011 11  1011
12  1100 12  1100
6 0110 6 0110
Received Checksum 1001
Sum 100100 Sum 101101
Carry 10 Carry 10
Sum 0110 Sum 1111
Checksum 1001 New Checksum 0000

Sender Receiver
 Checksum is well-suited for software implementation and is not strong as CRC.
 If value of one word is incremented and another word is decremented by the same
amount, the errors are not detected because sum and checksum remain the same.

Vijai Anand cseannauniv.blogspot.in


CS6651-Computer Networks 1.13

3. Cyclic Redundancy Check (CRC)


 CRC uses the concept of finite fields.
 A n bit message is represented as a polynomial of degree n - 1.
 Message M(x) is represented as a polynomial by using the value of each bit as coefficient
for each term. For example, 10011001 is represented as x7 + x4 + x3+ 1
 For calculating a CRC, sender and receiver agree on a divisor polynomial, C(x) of degree
k such that k ≤ n – 1
Sender
 Multiply M(x) by xk i.e., append k zeroes. Let the modified polynomial be M'(x)
 Divide M'(x) by C(x) using XOR operation. The remainder has k bits
 Subtract the remainder from M'(x) using XOR, say T(x) and transmit T(x) with n + k bits.

Sender Receiver
Receiver
 Divide the received polynomial T'(x) by C(x) as done in sender
 If the remainder is non-zero then discard the frame
 If zero, then no errors and redundant bits are removed to obtain data
Divisor Polynomial
 Divisor polynomial C(x) should has the following error-detecting properties:
o All single-bit errors, as long as the xk and x0 terms have nonzero coefficients.
o Any “burst” error for which the length of the burst is less than k bits.
o Any odd number of errors, as long as C(x) contains the factor (x + 1)
 It is implemented in hardware using a k-bit shift register and XOR gates.

 Widely used in networks such as LANs and WANs.


 Different versions of CRC are CRC-8, CRC-10, CRC-12, CRC-16, and CRC-32.

Vijai Anand cseannauniv.blogspot.in


CS6651-Computer Networks 1.14

Define flow control.


 Flow control is a set of procedures that tells the sender how much data it can transmit
before it must wait for an acknowledgment from the receiver.
 It prevents a fast sender from overwhelming a slow receiver with frames.
Define acknowledgement.
 An acknowledgment (ACK) is a small control frame that a protocol sends back to the
sender acknowledging the receipt of a frame.
 Frames are delivered in a reliable manner using acknowledgement
What is automatic repeat request?
 When a corrupt frame arrives at the receiver, it is discarded.
 If the sender does not receive an acknowledgment within a specified period (timeout), it
retransmits the original frame. This is known as automatic repeat request (ARQ).
 The two ARQ are Stop and Wait ARQ and Sliding Window ARQ
Explain various flow control mechanism or reliable transmission.
1. Stop and Wait ARQ
 Sender keeps a copy of the frame and then transmits it.
 Waits for an acknowledgment before transmitting the next frame.
 If acknowledgment does not arrive before timeout, sender retransmits the previous frame.

(a) (b) (c) (d)


Scenarios
a) ACK is received before the timer expires. The sender sends the next frame.
b) Frame gets lost in transmission. Sender eventually times out and retransmits frame.
c) ACK frame gets lost. The sender eventually times out and retransmits the frame.
d) Sender times out soon before ACK arrives and retransmits the frame.
Sequence number

Vijai Anand cseannauniv.blogspot.in


CS6651-Computer Networks 1.15

 Scenarios (c) and (d) leads to duplicate frames at the receiver’s end.
 Therefore header includes a 1-bit sequence number (0 or 1) based on modulo-2 arithmetic
 Inefficient since there can be only one outstanding frame, i.e., bandwidth is wasted.
2. Sliding Window
 Sliding window improves efficiency by allowing multiple frames to be in transit.

 window defines range of sequence numbers for both sender and receiver to deal with.
 Window position changes (slides) due to transmission of frames and ACKs.
Sender
 Sender assigns a sequence number SeqNum to each frame.
 A timer is associated with each frame it transmits, and retransmits the frame on timeout.
 It maintains three state variables:
o Sender window size SWS gives the upper bound on number of outstanding frames.
SWS is based on delay × bandwidth product.
o LAR denotes the sequence number of the last acknowledgment received.
o LFS denotes the sequence number of the last frame sent.
o Invariant LFS − LAR ≤ SWS is always maintained

 When an acknowledgment arrives, LAR moves to the right, allowing the sender to
transmit the subsequent frames.
 Sender buffers up to SWS frames (for retransmission), until they are acknowledged.
Receiver
 Similarly the receiver maintains three state variables:
o Receiver window size RWS gives the upper bound on number of out-of-order
frames that the receiver is willing to accept.
o LAF denotes acceptable frame with the largest sequence number
o LFR denotes sequence number of the last frame received
o Invariant LAF − LFR ≤ RWS is always maintained.

Vijai Anand cseannauniv.blogspot.in


CS6651-Computer Networks 1.16

 A frame numbered SeqNum is accepted if LFR < SeqNum ≤ LAF, otherwise discarded.
 Frames that arrive out of order is buffered but not acknowledged.
 If all preceding frames up to SeqNumToAck has arrived, then receiver acknowledges
frame SeqNumToAck. The acknowledgement is cumulative. Variables updated are:
o LFR = SeqNumToAck
o LAF = LFR + RWS
.Sequence Number
 Sequence numbers are modulo 2m where m is the size of sequence field and wrap around.
 To avoid the issue of identifying sequence numbers of different sets, SWS is defined as
SWS < (MaxSeqNum + 1) / 2
Example

Briefly discuss the two variants of sliding window protocol.


 The two variants of sliding window protocol are Selective Repeat and Go Back N.
1. Selective Repeat
 Size of RWS is same as SWS.
 When an out-of-order frame arrives, receiver sends a negative acknowledgement (NAK)
forcing the sender to retransmit the expected frame. This is known as Selective Repeat.
 NAK speeds up retransmission of a frame before timer expires and improves performance
2. Go-Back-N
 In Go-Back-N sliding window protocol, the size of receiver window is 1.
 The receiver accepts only the expected frame and discards any other frame that arrives.
 Sender eventually timeout and retransmits all outstanding frames.
 Not suited for noisy channels.

Vijai Anand cseannauniv.blogspot.in


CS6651-Computer Networks 1.17

List the advantages of sliding window flow control.


 Delivers frames reliably across an unreliable link using timeout and acknowledgement.
 Preserves the order in which frames are transmitted. The receiver ensures that it does not
pass a frame to the upper layer until all lower numbered frames are passed.
 Supports flow control. The receiver through acknowledgement informs the sender about
how many frames it can still receive.
Distinguish between Stop & Wait and Sliding window protocol.
 Only one frame could be outstanding in Stop-and-Wait, whereas multiple frames can be
outstanding in sliding window, i.e., improved efficiency.
 Frames are numbered as modulo-2m in sliding window whereas it is sequenced as
modulo-2 in stop and wait protocol.
 Stop-and-Wait ARQ protocol is a special case of sliding window in which the sender
window size is 1.

List the design issues of data link layer


 Framing—Breaking the bit stream into frames with well-defined frame boundary
 Error Control—Involves error detection & correction methods using redundant bits.
 Flow Control—Prevents fast sender from swamping a slow receiver with frames
 Access Control—Resolve conflicts when multiple nodes compete to transmit data over a
shared link.

What is concurrent logical channel?


 When more than one logical channel is multiplexed onto a single point-to-point link is
known as concurrent logical channel.
 Stop and wait is run on each of these logical channels.
 When a node has frame to send, it is sent on the lowest idle channel.

Bring out the differences between circuit and packet switching.


Circuit switching Packet switching
Source & destination are physically connected No such physical connection exists
Switching takes place at the physical layer Switching occurs at network / data link layer
Resources are allocated in advance. Resources are allocated on demand
Resources remain allocated for entire duration. Resources can be reallocated when idle.
No delay during data transfer. Delay exists at each switch during data transfer
Data transferred is a continuous flow of signal Data is transferred as discrete packets
Example: Telephony Example: Internet

State the different types of application on the Internet.


 Internet provides two major class of applications on the internet
1. Web page delivery in a browser using a URL, i.e. a simple file transfer using
TCP. For e.g. http://www.google.co.in
2. Streaming audio and video in a continuous manner. For example, Video on
demand (YouTube) and Internet Radio. VoIP applications using Skype or
Videoconferencing have timing constraints.

Vijai Anand cseannauniv.blogspot.in


CS6651-Computer Networks 1.18

Illustrate error correction method using an example.


 Error correcting codes determine the corrupted bits and correct it
 Allows the recipient to reconstruct the correct message even after it has been corrupted
 Hamming code is used to correct single bit error
 Reed Solomon code is used to correct burst errors
 The use of error-correcting codes is often referred to as forward error correction
Hamming code
 Hamming codes are code words formed by adding redundant check bits (parity bits) to a
data word
 A frame consists of m data (i.e., message) bits and r redundant or parity bits.
 An n-bit unit containing data and parity bits is known as an n-bit codeword.
 Error-detecting & error-correcting properties of a code depend on Hamming distance.
 To design a code with m message bits and r parity bits, that will allow all single errors to
be corrected, then 2r  m + r + 1.
 Bits of the codeword are numbered consecutively, starting with bit 1 from the left.
 Parity bits are bits that are powers of 2 (1, 2, 4, 8, 16, etc.) are.
 Remaining bits (3, 5, 6, 7, 9, 10, 11, 12, … etc.) are m data bits.
 Each parity bit forces the parity on some collection of bits, including itself, to be even.

 Position of parity bit determines the sequence of bits that it alternately checks and skips.
o P1─check parity for bits 1, 3, 5, 7, 9, 11, 13, ... (skip every bit alternately)
o P2─check parity for bits 2,3, 6,7, 10,11, 14,15, ... (skip every 2 bits alternately)
o P4─check parity for bits 4,5,6,7, 12,13,14,15, ... (skip every 4 bits alternately)
o P8─check parity for bits 8-15, 24-31, ... (skip every 8 bits alternately)
o P16─check parity for bits 16-31, 48-63, ... (skip every 16 bits alternately)
 Set a parity bit to 1 if the total number of ones in the positions it checks is odd.
Example
 Consider data 11010110 to be encoded using even-Hamming code.
 For the given data, m = 8 (no. of bits) and r takes value 4 such that 2r  m + r + 1
 The unknown parity bits are embedded into data at bit positions shown below:

 For P1, check parity for bits 1, 3, 5, 7, 9 and 11.


o Its value is 1 (? 0 1 0 1 1).
 For P2, check parity for bits 2, 3, 6, 7, 10 and 11.
o Its value is 0 (? 0 1 0 0 1).
 For P4, check parity for bits 4, 5, 6, 7 and 12.
o Its value is 1 (? 1 1 0 1).
 For P8, check parity for bits 8, 9, 10, 11 and 12. So its value is 1.
o Its value is 1 (? 1 1 0 1).
 The transmitted code word is 110110111001
Error correction
 If due to error, the received word is

Vijai Anand cseannauniv.blogspot.in


CS6651-Computer Networks 1.19

 The receiver computes parity bits and checks whether it is same as the received one.
 For P1', check parity for bits 1, 3, 5, 7, 9 and 11.
o Its value is 0 (? 0 0 0 1 1) and differs with the received value.
 For P2', check parity for bits 2, 3, 6, 7, 10 and 11.
o Its value is 0 (? 0 1 0 0 1) and is same as the received value.
 For P4', check parity for bits 4, 5, 6, 7 and 12.
o Its value is 0 (? 1 0 0 1) and differs with the received value.
 For P8', check parity for bits 8, 9, 10, 11 and 12.
o Its value is 1 (? 1 1 0 1) and is same as the received value.
 The bit positions of the non-matching parity bits are added to determine the corrupt bit.
 The corrupt bit is complemented and hence the original data is restored.
 In the given example, parity bits at position 1 and 4 do not match. Therefore, 5th bit (1+4)
is corrupt and changed to 1. The corrected data is 110110111001.

Vijai Anand cseannauniv.blogspot.in


CS6651-Computer Networks 1.20

Write a program to implement TCP chat application


 Chat application is a simple client/server program that uses the socket interface to send
messages over a TCP connection in half-duplex mode.

/* TCP Chat server program */


#include <stdio.h>
#include <string.h>
#include <netinet/in.h>
main()
{
int sd, bd, ad;
struct sockaddr_in servaddr, cliaddr;
socklen_t clilen;
char buff[1024], buff1[1024];

/* Socket address structure */


bzero(&servaddr, sizeof(servaddr));
servaddr.sin_family = AF_INET;
servaddr.sin_addr.s_addr = htonl(INADDR_ANY);
servaddr.sin_port = htons(5555);

/* TCP socket creation */


sd = socket(PF_INET, SOCK_STREAM, 0);

/* Passive Open */
bd = bind(sd, (struct sockaddr*)&servaddr, sizeof(servaddr));
listen(sd, 5);
ad = accept(sd, (struct sockaddr*)&cliaddr, &clilen);
printf("Client connection established\n");

while(1)
{
/* Receive message from client */
recv(ad, buff, sizeof(buff), 0);
printf("Received from the client: %s", buff);
if (strcmp(buff, "bye") == 0)
break;

/* Send message to the client */


printf("\nEnter the input data: ");
fgets(buff1, 1024, stdin);
send(ad, buff1, strlen(buff1)+1, 0);
}
printf("\nClient disconnected\n");
}

Vijai Anand cseannauniv.blogspot.in


CS6651-Computer Networks 1.21

 Header file <netinet/in.h> defines IPv4 socket address structure


 Port number is assigned to 5555 that is not used for any internet service.
 Server IP address is set to INADDR_ANY to accept connections on any of the interfaces.
 After passive open, server exchanges messages with the client.

/* TCP Chat client program */


#include <stdio.h>
#include <string.h>
#include <netinet/in.h>
main(int argc, char *argv[])
{
int sd, cd;
struct sockaddr_in servaddr;
char buff[1024], buff1[1024];

bzero(&servaddr, sizeof(servaddr));
servaddr.sin_family = AF_INET;
if (argc == 2)
servaddr.sin_addr.s_addr = inet_addr(argv[1]);
else
servaddr.sin_addr.s_addr = inet_addr("127.0.0.1");
servaddr.sin_port = htons(5555);

sd = socket(PF_INET, SOCK_STREAM, 0);

/* Active Open */
cd = connect(sd, (struct sockaddr*)&servaddr, sizeof(servaddr));

printf("Enter \"bye\" to quit\n");


while(1)
{
printf("Enter the input data: ");
gets(buff);
send(sd, buff, strlen(buff)+1, 0);
if (strcmp(buff, "bye") == 0)
break;
recv(sd, buff1, sizeof(buff1), 0);
printf("Received from the server: %s", buff1);
}
printf("Connection Terminated\n");
}

 Client creates a socket interface and opens an active connection with the server.
 If server's IP address is not given as command line argument, then server process is
running on the same localhost.
 Client uses sentinel value (bye) to terminate the connection.

Vijai Anand cseannauniv.blogspot.in

Vous aimerez peut-être aussi