0% found this document useful (0 votes)
14 views25 pages

Cit 303 Lecture Note Part 1

The document provides an overview of Internet Protocol (IP) and the OSI model, detailing the functions and responsibilities of each of the seven layers in the OSI model. It explains how data is transmitted across networks, the role of various protocols such as TCP/IP and HTTPS, and the specific functions of each layer, including the Physical, Data Link, Network, Transport, Session, Presentation, and Application layers. Additionally, it highlights the advantages of the OSI model in standardizing communication and troubleshooting network issues.

Uploaded by

mohgydado
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views25 pages

Cit 303 Lecture Note Part 1

The document provides an overview of Internet Protocol (IP) and the OSI model, detailing the functions and responsibilities of each of the seven layers in the OSI model. It explains how data is transmitted across networks, the role of various protocols such as TCP/IP and HTTPS, and the specific functions of each layer, including the Physical, Data Link, Network, Transport, Session, Presentation, and Application layers. Additionally, it highlights the advantages of the OSI model in standardizing communication and troubleshooting network issues.

Uploaded by

mohgydado
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

INTERNET PROTOCOL AND CLIENT SERVER PROGRAMMING (CIT 303)

Internet: Is the global system of interconnected computer networks that uses the internet
protocols suites (TCP/IP) to communicate between networks devices.
Protocol: Is a set of rules and guidelines for communicating data. It is a digital languages
through which we communicate with others on internet.
Protocol in networking: Is a set of rules for formatting and processing data.
Internet Protocol (IP): Is a set of rules that governs the communication and exchange of data
over the internet. IP is responsible for routing and addressing packets of data so that they can
travel across networks and arrive at the correct destination. IP is a network layer protocol that
enables internetworking and establishes the internet.

EXAMPLE OF PROTOCOL (TYPE OF INTERNET PROTOCOL)


1. TCP/IP (Transmission control protocol/ Internet protocol
2. HTTPS (Secure Hyper Text Transmission Protocol)
3. SMTP (Simple mail transfer protocol)
4. DNS (Domain name system)
5. UDP (User datagram protocol) etc.

HOW DOES IP WORTK


Internet Protocol: Is underlying technology that makes the internet possible. IP connects with
hosts through interfaces and is responsible for addressing host interfaces, encapsulating data
into datagrams, and routing datagrams from a source host interface to a destination host across
one or more IP networks. IP information is attached to each packet, and this information helps
routers to send packets to the right place. Every device or domain that connects to the internet
is assigned an IP address and as packets are directed to the IP address attached to them, data
arrives where it is needed.

What is OSI Model?


The OSI model, created in 1984 by ISO, is a reference framework that explains the process of
transmitting data between computers. It is divided into seven layers that work together to carry
out specialized network functions, allowing for a more systematic approach to networking.

What are the 7 layers of the OSI Model?


The OSI model consists of seven abstraction layers arranged in a top-down order:
1. Physical Layer
2. Data Link Layer
3. Network Layer
4. Transport Layer
5. Session Layer
6. Presentation Layer
7. Application Layer
Physical Layer – Layer 1

The lowest layer of the OSI reference model is the physical layer. It is responsible for the
actual physical connection between the devices. The physical layer contains information in the
form of bits. It is responsible for transmitting individual bits from one node to the next. When
receiving data, this layer will get the signal received and convert it into 0s and 1s and send
them to the Data Link layer, which will put the frame back together.

Functions of the Physical Layer

 Bit synchronization: The physical layer provides the synchronization of the bits by
providing a clock. This clock controls both sender and receiver thus providing
synchronization at the bit level.
 Bit rate control: The Physical layer also defines the transmission rate i.e. the number of
bits sent per second.
 Physical topologies: Physical layer specifies how the different, devices/nodes are arranged
in a network i.e. bus, star, or mesh topology.
 Transmission mode: Physical layer also defines how the data flows between the two
connected devices. The various transmission modes possible are simplex, half-duplex and
full-duplex.
Note:
1. Hub, Repeater, Modem, and Cables are Physical Layer devices.
2. Network Layer, Data Link Layer, and Physical Layer are also known as Lower
Layers or Hardware Layers.
Data Link Layer (DLL) – Layer 2

The data link layer is responsible for the node-to-node delivery of the message. The main
function of this layer is to make sure data transfer is error-free from one node to another, over
the physical layer. When a packet arrives in a network, it is the responsibility of the DLL to
transmit it to the Host using its MAC address.
The Data Link Layer is divided into two sub layers:
1. Logical Link Control (LLC)
2. Media Access Control (MAC)
The packet received from the Network layer is further divided into frames depending on the
frame size of the NIC (Network Interface Card). DLL also encapsulates Sender and Receiver‟s
MAC address in the header.
The Receiver‟s MAC address is obtained by placing an ARP(Address Resolution
Protocol) request onto the wire asking “Who has that IP address?” and the destination host will
reply with its MAC address.

Functions of the Data Link Layer

 Framing: Framing is a function of the data link layer. It provides a way for a sender to
transmit a set of bits that are meaningful to the receiver. This can be accomplished by
attaching special bit patterns to the beginning and end of the frame.
 Physical addressing: After creating frames, the Data link layer adds physical addresses
(MAC addresses) of the sender and/or receiver in the header of each frame.
 Error control: The data link layer provides the mechanism of error control in which it
detects and retransmits damaged or lost frames.
 Flow Control: The data rate must be constant on both sides else the data may get corrupted
thus; flow control coordinates the amount of data that can be sent before receiving an
acknowledgment.
 Access control: When a single communication channel is shared by multiple devices, the
MAC sub-layer of the data link layer helps to determine which device has control over the
channel at a given time.

Note:
1. Packet in the Data Link layer is referred to as Frame.
2. Data Link layer is handled by the NIC (Network Interface Card) and device drivers of host
machines.
3. Switch & Bridge are Data Link Layer devices.
Network Layer – Layer 3

The network layer works for the transmission of data from one host to the other located in
different networks. It also takes care of packet routing i.e. selection of the shortest path to
transmit the packet, from the number of routes available. The sender & receiver‟s IP addresses
are placed in the header by the network layer.

Functions of the Network Layer

 Routing: The network layer protocols determine which route is suitable from source to
destination. This function of the network layer is known as routing.
 Logical Addressing: To identify each device inter-network uniquely, the network layer
defines an addressing scheme. The sender & receiver‟s IP addresses are placed in the
header by the network layer. Such an address distinguishes each device uniquely and
universally.
Note:
1. Segment in the Network layer is referred to as Packet.
2. Network layer is implemented by networking devices such as routers and switches.
Transport Layer – Layer 4

The transport layer provides services to the application layer and takes services from the
network layer. The data in the transport layer is referred to as Segments. It is responsible for
the end-to-end delivery of the complete message. The transport layer also provides the
acknowledgment of the successful data transmission and re-transmits the data if an error is
found.
At the sender’s side: The transport layer receives the formatted data from the upper layers,
performs Segmentation, and also implements Flow and error control to ensure proper data
transmission. It also adds Source and Destination port numbers in its header and forwards the
segmented data to the Network Layer.
Note: The sender needs to know the port number associated with the receiver‟s application.
Generally, this destination port number is configured, either by default or manually. For
example, when a web application requests a web server, it typically uses port number 80,
because this is the default port assigned to web applications. Many applications have default
ports assigned.

At the receiver’s side: Transport Layer reads the port number from its header and forwards
the Data which it has received to the respective application. It also performs sequencing and
reassembling of the segmented data.
Functions of the Transport Layer

 Segmentation and Reassembly: This layer accepts the message from the (session) layer,
and breaks the message into smaller units. Each of the segments produced has a header
associated with it. The transport layer at the destination station reassembles the message.
 Service Point Addressing: To deliver the message to the correct process, the transport
layer header includes a type of address called service point address or port address. Thus by
specifying this address, the transport layer makes sure that the message is delivered to the
correct process.

Services Provided by Transport Layer


1. Connection-Oriented Service
2. Connectionless Service
1. Connection-Oriented Service: It is a three-phase process that includes
 Connection Establishment
 Data Transfer
 Termination/disconnection
In this type of transmission, the receiving device sends an acknowledgment, back to the source
after a packet or group of packets is received. This type of transmission is reliable and secure.
3. Connectionless service: It is a one-phase process and includes Data Transfer. In this
type of transmission, the receiver does not acknowledge receipt of a packet. This
approach allows for much faster communication between devices. Connection-oriented
service is more reliable than connectionless Service.
Note:
1. Data in the Transport Layer is called Segments.
2. Transport layer is operated by the Operating System. It is a part of the OS and
communicates with the Application Layer by making system calls.
3. The transport layer is called as Heart of the OSI model.
4. Device or Protocol Use : TCP, UDP NetBIOS, PPTP
Session Layer – Layer 5

This layer is responsible for the establishment of connection, maintenance of sessions, and
authentication, and also ensures security.
Functions of the Session Layer

 Session establishment, maintenance, and termination: The layer allows the two
processes to establish, use, and terminate a connection.
 Synchronization: This layer allows a process to add checkpoints that are considered
synchronization points in the data. These synchronization points help to identify the error
so that the data is re-synchronized properly, and ends of the messages are not cut
prematurely and data loss is avoided.
 Dialog Controller: The session layer allows two systems to start communication with each
other in half-duplex or full-duplex.
Note:
1. All the below 3 layers(including Session Layer) are integrated as a single layer in
the TCP/IP model as the “Application Layer”.
2. Implementation of these 3 layers is done by the network application itself. These are also
known as Upper Layers or Software Layers.
3. Device or Protocol Use: NetBIOS, PPTP.
For example:-
Let us consider a scenario where a user wants to send a message through some Messenger
application running in their browser. The “Messenger” here acts as the application layer which
provides the user with an interface to create the data. This message or so-called Data is
compressed, optionally encrypted (if the data is sensitive), and converted into bits (0‟s and 1‟s)
so that it can be transmitted.

Presentation Layer – Layer 6

The presentation layer is also called the Translation layer. The data from the application layer
is extracted here and manipulated as per the required format to transmit over the network.

Functions of the Presentation Layer


 Translation: For example, ASCII to EBCDIC.
 Encryption/ Decryption: Data encryption translates the data into another form or code.
The encrypted data is known as the cipher text and the decrypted data is known as plain
text. A key value is used for encrypting as well as decrypting data.
 Compression: Reduces the number of bits that need to be transmitted on the network.

Note: Device or Protocol Use: JPEG, MPEG, GIF

Application Layer – Layer 7

At the very top of the OSI Reference Model stack of layers, we find the Application layer
which is implemented by the network applications. These applications produce the data to be
transferred over the network. This layer also serves as a window for the application services to
access the network and for displaying the received information to the user.
Example: Application – Browsers, Skype Messenger, etc.
Note: 1. the application Layer is also called Desktop Layer.
2. Device or Protocol Use: SMTP
Functions of the Application Layer

The main functions of the application layer are given below.


 Network Virtual Terminal (NVT): It allows a user to log on to a remote host.
 File transfer access and management (FTAM): This application allows a user to
access files in a remote host, retrieve files in a remote host, and manage or
control files from a remote computer.
 Mail Services: Provide email service.
 Directory Services: This application provides distributed database sources
and access for global information about various objects and services.

Note: The OSI model acts as a reference model and is not implemented on the Internet because
of its late invention. The current model being used is the TCP/IP model.

What is the Flow of Data in OSI Model?


When we transfer information from one device to another, it travels through 7 layers of OSI
model. First data travels down through 7 layers from the sender‟s end and then climbs back 7
layers on the receiver‟s end.

EXAMPLE
Let‟s look at it with an Example:
Khadija sends an e-mail to her friend Safiyya.
Step 1: Khadija interacts with e-mail application like Gmail, outlook, etc. Write her email to
send. (This happens in Layer 7: Application layer)
Step 2: Mail application prepares for data transmission like encrypting data and formatting it
for transmission. (This happens in Layer 6: Presentation Layer)
Step 3: There is a connection established between the sender and receiver on the internet.
(This happens in Layer 5: Session Layer)
Step 4: Email data is broken into smaller segments. It adds sequence number and error-
checking information to maintain the reliability of the information. (This happens in Layer 4:
Transport Layer)
Step 5: Addressing of packets is done in order to find the best route for transfer. (This happens
in Layer 3: Network Layer)
Step 6: Data packets are encapsulated into frames, then MAC address is added for local
devices and then it checks for error using error detection. (This happens in Layer 2: Data
Link Layer)
Step 7: Lastly Frames are transmitted in the form of electrical/ optical signals over a physical
network medium like Ethernet cable or Wi-Fi.
After the email reaches the receiver i.e. Safiyya, the process will reverse and decrypt the e-mail
content. At last, the email will be shown on Safiyya‟s email client.
Advantages of OSI Model

The OSI Model defines the communication of a computing system into 7 different layers. Its
advantages include:
 It divides network communication into 7 layers which makes it easier to understand and
troubleshoot.
 It standardizes network communications, as each layer has fixed functions and protocols.
 Diagnosing network problems is easier with the OSI model.
 It is easier to improve with advancements as each layer can get updates separately.

Transport Layer in OSI Model

The transport layer is positioned between the network and session layers in the OSI paradigm.
The data packets must be taken and sent to the appropriate machine by the network layer. After
that, the transport layer receives the packets, sorts them, and looks for faults. Subsequently, it
directs them to the session layer of the appropriate computer program. Now, the properly
structured packets are used by the session layer to hold the data for the application.

Functions of Transport Layer


The Transport Layer is responsible for end-to-end communication of data packets. It provides a
number of important functions that are responsible for reliable, efficient, and organized data
transfer between host systems in a networked environment.
The primary functions of the Transport Layer are:
 To enable efficient network transmission, the Transport Layer splits the total amount of data
it gets from the applications running at the top layers into smaller units known as segments.
The Transport Layer puts these bits back together into the original data stream at the other
end.
 In situations when organized data transfer is required, the Transport Layer creates a
connection between the source and the destination. In order to create the proper parameters
and guarantee that both systems are prepared to communicate data, a handshake protocol is
established. When the data transfer is complete, the Transport Layer closes the connection.
 The transport layer also assures dependable data transmission. Receiving acknowledgments,
or ACK bits, is how this is accomplished. While waiting for the recipient to acknowledge the
parts it sent, the sender keeps an eye on them. Any damaged segments are retransmitted by
the sender if they receive an acknowledgment.
 Flow regulation is one of the Transport Layer‟s most crucial roles. In order to prevent data
overload, it regulates the data transfer rate. This is done by utilizing protocols like the sliding
window protocol, which is carried out by the receiver telling the sender of the maximum
amount of data it may receive by sending back a window.
 Both error detection and repair are handled by the transport layer. Checksums are one of
these techniques for error detection. By computing and validating checksums, it can ascertain
whether data was tampered with during transmission. The Transport Layer may request
retransmission if it finds anything.

Characteristics of Transport Layer

1. Service-point addressing
As a result of computers running many programs at once, data is transmitted from one source to
the destination, connecting not only one computer to another, but also different processes. The
header with the address known as a service-point address or port address is added by the
transport layer. The transport layer is in charge of sending the message to the appropriate
process, whereas the network layer is in charge of sending data from one computer to another.
2. Segmentation and reassembly
The message is split up into numerous segments by the transport layer when it receives it from
the top layer. Each segment is given a unique sequence number. The transport layer reassembles
the message based on sequence numbers once it has reached its destination.
3. Connection control
Two services are offered by the transport layer. Both connectionless and connection-oriented
services are available. Every segment is handled as a separate packet by a connectionless service,
and they all take distinct paths to get there. Every packet in a connection-oriented service follows
the same path.
4. Flow control
Although it is carried out end-to-end rather than via a single link, the transport layer is likewise
in charge of it. It is very essential because it is possible for sender to transmit data or information
at very fast rate and hence receiver can receive this information and process it
5. Error control
This function is likewise carried out by the transport layer. Error control is not carried out across
the single link, but rather end-to-end. Error Control ensures that the data packet is received to the
destination without any error.
Working of Transport Layer
Communication between end systems is dependable and effective thanks to the Transport Layer.
Apart from regulating flow and accommodating numerous applications concurrently, it
guarantees data delivery in a manner that guarantees accuracy and minimizes mistakes. It
accomplishes this by utilizing a collection of methods and protocols that provide data transport.

 The fourth layer down is the transport layer.


 The primary function of the transport layer is to give application processes operating on
several hosts‟ direct access to communication services.
 Logical communication between application processes operating on separate hosts is
facilitated by the transport layer. Application processes use the logical communication
offered by the transport layer to deliver messages to one other even when they are running on
different hosts and are not physically connected.
 The network routers do not implement the transport layer protocols; only the end systems do.
 For instance, the network layer receives services from TCP and UDP, two transport layer
protocols, which offer distinct functionalities.
 Protocols at the transport layer offer multiplexing and demultiplexing capabilities. In
addition, it offers other services including bandwidth assurances, latency guarantees, and
dependable data transport.
 Every application at the application layer is capable of sending a message via either TCP or
UDP. Either of these two protocols can be used by the application to interact. The internet
protocol on the internet layer will then be communicated with by both TCP and UDP. The
transport layer is readable and writeable by the applications.
Transport Layer Protocols
Transport Layer Protocol uses different protocol for the better communication between two ends
uses of protocol may differ from specifications. Below mention are some protocols used in
Transport Layer
1. Transmission Control Protocol (TCP)
 TCP is connection-oriented Protocol.
 TCP is reliable protocol.
 As TCP is connection-oriented protocol, so first the connection is established between two
ends and then data is transferred and then the connection is terminated after all data being
sent.
2. User Datagram Protocol (UDP)
 UDP is not reliable protocol
 The protocol UDP is connectionless.
 When speed and size are more important than security and dependability, this kind of
protocol is employed.
 The data from the higher layer is supplemented with transport-level addresses, checksum
error control, and length information by UDP, an end-to-end transport level protocol.
 A user datagram is the packet that the UDP protocol generates.
3. Stream Control Transmission Protocol (SCTP)
 An IP Transport Layer protocol is called Stream Control Transmission Protocol (SCTP).
 Many Internet applications use SCTP to perform transport layer duties, similar to User
Datagram Protocol (UDP) and Transmission Control Protocol (TCP).
 On top of a connectionless packet network like IP, SCTP is a dependable transport protocol
that facilitates data transfer over the network in scenarios involving one or more IP
addresses.

Difference between TCP and UDP at Transport Layer

TCP UDP

TCP is a connection-oriented protocol UDP is the connection-less protocol

TCP is reliable. UDP is not reliable.

UDP has only the basic error-checking


TCP supports error-checking mechanisms.
mechanism using checksums.

An acknowledgment segment is present. No acknowledgment segment.

UDP is faster, simpler, and more efficient


TCP is slower than UDP
than TCP.

Retransmission of lost packets is possible in There is no retransmission of lost packets in


TCP, but not in UDP. the User Datagram Protocol (UDP)

TCP has a (20-60) bytes variable length


The header length is fixed of 8 bytes.
header.
Basics of Computer Networking
Computer Networking is the practice of connecting computers together to enable communication
and data exchange between them. In general, Computer Network is a collection of two or more
computers. It helps users to communicate more easily. In this article, we are going to discuss the
basics which everyone must know before going deep into Computer Networking.

Computer Networking

How Does a Computer Network Work?


Basics building blocks of a Computer network are Nodes and Links. A Network Node can be
illustrated as Equipment for Data Communication like a Modem, Router, etc., or Equipment of a
Data Terminal like connecting two computers or more. Link in Computer Networks can be
defined as wires or cables or free space of wireless networks.
The working of Computer Networks can be simply defined as rules or protocols which help in
sending and receiving data via the links which allow Computer networks to communicate. Each
device has an IP Address that helps in identifying a device.
Basic Terminologies of Computer Networks

 Network: A network is a collection of computers and devices that are connected together to
enable communication and data exchange.
 Nodes: Nodes are devices that are connected to a network. These can include computers,
Servers, Printers, Routers, Switches, and other devices.
 Protocol: A protocol is a set of rules and standards that govern how data is transmitted over
a network. Examples of protocols include TCP/IP, HTTP, and FTP.
 Topology: Network topology refers to the physical and logical arrangement of nodes on a
network. The common network topologies include bus, star, ring, mesh, and tree.
 Service Provider Networks: These types of Networks give permission to take Network
Capacity and Functionality on lease from the Provider. Service Provider Networks include
Wireless Communications, Data Carriers, etc.
 IP Address: An IP address is a unique numerical identifier that is assigned to every device
on a network. IP addresses are used to identify devices and enable communication between
them.
 DNS: The Domain Name System (DNS) is a protocol that is used to translate human-
readable domain names (such as www.google.com) into IP addresses that computers can
understand.
 Firewall: A firewall is a security device that is used to monitor and control incoming and
outgoing network traffic. Firewalls are used to protect networks from unauthorized access
and other security threats.
Types of Enterprise Computer Networks
 LAN: A Local Area Network (LAN) is a network that covers a small area, such as an office
or a home. LANs are typically used to connect computers and other devices within a building
or a campus.
 WAN: A Wide Area Network (WAN) is a network that covers a large geographic area, such
as a city, country, or even the entire world. WANs are used to connect LANs together and are
typically used for long-distance communication.
 Cloud Networks: Cloud Networks can be visualized with a Wide Area Network (WAN) as
they can be hosted on public or private cloud service providers and cloud networks are
available if there is a demand. Cloud Networks consist of Virtual Routers, Firewalls, etc.
These are just a few basic concepts of computer networking. Networking is a vast and complex
field, and there are many more concepts and technologies involved in building and maintaining
networks. Now we are going to discuss some more concepts on Computer Networking.
 Open system: A system that is connected to the network and is ready for communication.
 Closed system: A system that is not connected to the network and can‟t be communicated
with.
Types of Computer Network Architecture
Computer Network falls under these broad Categories:
 Client-Server Architecture: Client-Server Architecture is a type of Computer Network
Architecture in which Nodes can be Servers or Clients. Here, the server node can manage the
Client Node Behavior.
 Peer-to-Peer Architecture: In P2P (Peer-to-Peer) Architecture, there is not any concept of a
Central Server. Each device is free for working as either client or server.
Network Devices

An interconnection of multiple devices, also known as hosts, that are connected using multiple
paths for the purpose of sending/receiving data or media. Computer networks can also include
multiple devices/mediums which help in the communication between two different devices;
these are known as Network devices and include things such as routers, switches, hubs, and
bridges.

/
Network Devices

Network Topology
The Network Topology is the layout arrangement of the different devices in a network. Common
examples include Bus, Star, Mesh, Ring, and Daisy chain.

Network Topology
Protocol
A protocol is a set of rules or algorithms which define the way how two entities can
communicate across the network and there exists a different protocol defined at each layer of the
OSI model. A few such protocols are TCP, IP, UDP, ARP, DHCP, FTP, and so on.
Unique Identifiers of Network
Hostname: Each device in the network is associated with a unique device name known as
Hostname. Type “hostname” in the command prompt(Administrator Mode) and press „Enter‟,
this displays the hostname of your machine.

HostName

IP Address (Internet Protocol address): Also known as the Logical Address, the IP Address is
the network address of the system across the network. To identify each device in the world-wide-
web, the Internet Assigned Numbers Authority (IANA) assigns an IPV4 (Version 4) address as a
unique identifier to each device on the Internet. The length of an IPv4 address is 32 bits, hence,
we have 232 IP addresses available. The length of an IPv6 address is 128 bits.
Type “ipconfig” in the command prompt and press „Enter‟, this gives us the IP address of the
device.
MAC Address (Media Access Control address): Also known as physical address, the MAC
Address is the unique identifier of each host and is associated with its NIC (Network Interface
Card). A MAC address is assigned to the NIC at the time of manufacturing. The length of the
MAC address is: 12-nibble/ 6 bytes/ 48 bits Type “ipconfig/all” in the command prompt and
press „Enter‟, this gives us the MAC address.
Port: A port can be referred to as a logical channel through which data can be sent / received to
an application. Any host may have multiple applications running, and each of these applications
is identified using the port number on which they are running.
A port number is a 16-bit integer; hence, we have 216 ports available which are categorized as
shown below:
Port Types Range

Well known Ports 0 – 1023

Registered Ports 1024 – 49151

Ephemeral Ports 49152 – 65535

Number of ports: 65,536


Range: 0 – 65535
Type “netstat -a” in the command prompt and press „Enter‟, this lists all the ports being used.

List of Ports

DNS Server: DNS stands for Domain Name System. DNS is basically a server that translates
web addresses or URLs (ex: www.google.com) into their corresponding IP addresses. We don‟t
have to remember all the IP addresses of each and every website. The command „nslookup‟
gives you the IP address of the domain you are looking for. This also provides information on
our DNS Server.
Domain IP Address

ARP: ARP stands for Address Resolution Protocol. It is used to convert an IP address to its
corresponding physical address (i.e., MAC Address). ARP is used by the Data Link Layer to
identify the MAC address of the Receiver‟s machine.
RARP: RARP stands for Reverse Address Resolution Protocol. As the name suggests, it
provides the IP address of the device given a physical address as input. But RARP has become
obsolete since the time DHCP has come into the picture.

CLIENT
A client is a computer hardware device or software that accesses a service made available by a
server. The server is often (but not always) located on a separate physical computer.
SERVER
A server is a physical computer dedicated to run services to serve the needs of other computers.
Depending on the service that is running, it could be a file server, database server, home media
server, print server, or web server.
HOST
A host is a computer, connected to other computers for which it provides data or services over a
network. In theory, every computer connected to a network acts as a host to other peers on the
network. In essence, a host reflects the logical relationship of two or more computers on a
network.
To simplify this, suppose you want to download an image from another computer on your
network. That computer is “hosting” the image and therefore, it is the host computer. On the
other hand, if that same computer downloads an image from your computer, your computer
becomes the host computer. Your computer can be a host to other computers. Likewise, your
router can be a host to other routers. But a host must have an assigned IP address. Therefore,
modems, hubs, and switches are not considered hosts because they do not have assigned IP
addresses.
SOCKET
Socket: The unique combination of IP address and Port number together is termed a Socket.

Socket in Computer Network

A socket is one endpoint of a two way communication link between two programs running on
the network. The socket mechanism provides a means of inter-process communication (IPC) by
establishing named contact points between which the communication takes place.
Like „Pipe‟ is used to create pipes and sockets is created using ‘socket’ system call. The socket
provides bidirectional FIFO Communication facility over the network. A socket connecting to
the network is created at each end of the communication. Each socket has a specific address.
This address is composed of an IP address and a port number.
Socket is generally employed in client server applications. The server creates a socket, attaches it
to a network port addresses then waits for the client to contact it. The client creates a socket and
then attempts to connect to the server socket. When the connection is established, transfer of data

takes place.
Types of Sockets: There are two types of Sockets: the datagram socket and the stream socket.
1. Datagram Socket: This is a type of network which has connection less point for sending and
receiving packets. It is similar to mailbox. The letters (data) posted into the box are collected
and delivered (transmitted) to a letterbox (receiving socket).
2. Stream Socket: In Computer operating system, a stream socket is type of inter-process
communications socket or network socket which provides a connection-oriented,
sequenced, and unique flow of data without record boundaries with well-defined
mechanisms for creating and destroying connections and for detecting errors. It is similar
to phone. A connection is established between the phones (two ends) and a conversation
(transfer of data) takes place.
Function Call Description

Socket() To create a socket

Bind() It‟s a socket identification like a telephone number to contact

Listen() Ready to receive a connection

Connect() Ready to act as a sender

Accept() Confirmation, it is like accepting to receive a call from a sender

Write() To send data

Read() To receive data

Close() To close a connection


Difference between Socket and Port

Both Socket and Port are the terms used in Transport Layer. A port is a logical construct
assigned to network processes so that they can be identified within the system. A socket is a
combination of port and IP address. Port number can be represented by a single number
(example: 1028) on the other hand socket address can be represented by (TCP, hostname, 1028).
An incoming packet has a port number which is used to identify the process that needs to
consume the packet. The lowest numbered 1024 port numbers are used for the most commonly
used services. These ports are called the well-known ports. Higher-numbered ports are available
for general use by applications and are known as ephemeral ports.

Socket Port

The word “Socket” is the combination of The word “Port” is the number used by particular
port and IP address. software.

It is used to identify both a machine and a The same port number can be used in different
service within the machine. computer running on same software.

A socket is a mechanism for allowing communication between processes, be it programs running


on the same machine or different computers connected on a network. More specifically, Internet
sockets provide a programming interface to the network protocol stack that is managed by the
operating system. Using this API, a programmer can quickly initialize a socket and send
messages without having to worry about issues such as packet framing or transmission control.
There are a number of different types of sockets available, but we are only really interested in
two specific Internet sockets. These are: • Stream sockets • Datagram sockets what differentiates
these two socket types is the transport protocol used for data transmission.

A stream socket: uses the Transmission Control Protocol (TCP) for sending messages. TCP
provides an ordered and reliable connection between two hosts. This means that for every
message sent, TCP guarantees that the message will arrive at the host in the correct order. This is
achieved at the transport layer so the programmer does not have to worry about this; it is all done
for you.

A datagram socket: uses the User Datagram Protocol (UDP) for sending messages. UDP is a
much simpler protocol as it does not provide any of the delivery guarantees that TCP does.
Messages, called datagrams, can be sent to another host without requiring any prior
communication or a connection having been established. As such, using UDP can lead to lost
messages or messages being received out of order. It is assumed that the application can tolerate
an occasional lost message or that the application will handle the issue of retransmission.
Advantages and Disadvantages of Stream and Datagram Socket

There are advantages and disadvantages to using either protocol or it will be highly dependent of
the application context. For example, when transferring a file you want to ensure that, upon
receipt, the file has not become corrupted. TCP will handle all the error checking and guarantee
that it will arrive as you sent it. On the other hand, imagine you are sending 1000 messages
detailing player position data every second in a computer game. The application will be able to
tolerate missing messages here so UDP would be more suitable.

Client Server Model


There are two important models used to organize a networked application. The first and oldest
model is the client server model. In this model, a server provides services to clients that
exchange information with it. This model is highly asymmetrical: clients send requests and
servers perform actions and return responses. It is illustrated in the figure below.

The Client-Server Model


The client-server model was the first model to be used to develop networked applications. This
model comes naturally from the mainframes and minicomputers that were the only networked
computers used until the 1980s. A minicomputer is a multi-user system that is used by tens or
more users at the same time. Each user interacts with the minicomputer by using a terminal.
Those terminals were mainly a screen, a keyboard and a cable directly connected to the
minicomputer. There are various types of servers as well as various types of clients. A web
server provides information in response to the query sent by its clients. A print server prints
documents sent as queries by the client. An email server will forward towards their recipient the
email messages sent as queries while a music server will deliver the music requested by the
client. From the viewpoint of the application developer, the client and the server applications
directly exchange messages (the horizontal arrows labeled Queries and Responses in the above
figure), but in practice these messages are exchanged thanks to the underlying layers (the vertical
arrows in the above figure). In this chapter, we focus on these horizontal exchanges of messages.

The Transport Services


The transport services Networked applications are built on top of the transport service. As
explained in the previous chapter, there are two main types of transport services: • the
connectionless or datagram service • the connection-oriented or byte-stream service the
connectionless service allows applications to easily exchange messages or Service Data Units.
On the Internet, this service is provided by the UDP protocol that will be explained in the next
chapter. The connectionless transport service on the Internet is unreliable, but is able to detect
transmission errors. This implies that an application will not receive an SDU that has been
corrupted due to transmission errors. The connectionless transport service allows networked
application to exchange messages. Several networked applications may be running at the same
time on a single host. Each of these applications must be able to exchange SDUs with remote
applications. To enable these exchanges of SDUs, each networked application running on a host
is identified by the following information: • the host on which the application is running • the
port number on which the application listens for SDUs.
On the Internet, the port number is an integer and the host is identified by its network address. As
we will see in chapter The network layer there are two types of Internet Addresses : • IP version
4 addresses that are 32 bits wide • IP version 6 addresses that are 128 bits wide IPv4 addresses
are usually represented by using a dotted decimal representation where each decimal number
corresponds to one byte of the address, e.g. 203.0.113.56. IPv6 addresses are usually represented
as a set of hexadecimal numbers separated by semicolons, e.g.
2001:db8:3080:2:217:f2ff:fed6:65c0. Today, most Internet hosts have one IPv4 address. A small
fraction of them also have an IPv6 address. In the future, we can expect that more and more hosts
will have IPv6 addresses and that some of them will not have an IPv4 address anymore. A host
that only has an IPv4 address cannot communicate with a host having only an IPv6 address. The
figure below illustrates two that are using the datagram service provided by UDP on hosts that
are using IPv4 addresses
Network Programming

Network applications are everywhere. Any time you browse the Web, send an email message, or
pop up an X window, you are using a network application. Interestingly, all network applications
are based on the same basic programming model, have similar overall logical structures, and rely
on the same programming interface. Network applications rely on many of the concepts that you
have already learned in our study of systems. For example, processes, signals, byte ordering,
memory mapping, and dynamic storage allocation all play important roles. There are new
concepts to master as well. We will need to understand the basic client server programming
model and how to write client-server programs that use the services provided by the Internet. At
the end, we will tie all of these ideas together by developing a small but functional Web server
that can serve both static and dynamic content with text and graphics to real Web browsers.

The Client-Server Programming Model

Every network application is based on the client-server model. With this model, an application
consists of a server process and one or more client processes. A server manages some resource,
and it provides some service for its clients by manipulating that resource. For example, a Web
server manages a set of disk files that it retrieves and executes on behalf of clients. An FTP
server manages a set of disk files that it stores and retrieves for clients. Similarly, an email server
manages a spool file that it reads and updates for clients. The fundamental operation in the
client-server model is the transaction (Figure 11.1).
A client-server transaction consists of four steps:
1. When a client needs service, it initiates a transaction by sending a request to the server. For
example, when a Web browser needs a file, it sends a request to a Web server.
2. The server receives the request, interprets it, and manipulates its resources in the appropriate
way. For example, when a Web server receives a request from a browser, it reads a disk file.
3. The server sends a response to the client, and then waits for the next request. For example, a
Web server sends the file back to a client.
4. The client receives the response and manipulates it. For example, after a Web browser
receives a page from the server, it displays it on the screen.

It is important to realize that clients and servers are processes and not machines, or hosts as they
are often called in this context. A single host can run many different clients and servers
concurrently, and a client and server transaction can be on the same or different hosts. The client-
server model is the same, regardless of the mapping of clients and servers to hosts.

Networks
Clients and servers often run on separate hosts and communicate using the hardware and
software resources of a computer network.
An Ethernet segment consists of some wires (usually twisted pairs of wires) and a small box
called a hub, as shown in Figure 11.3. Ethernet segments typically span small areas, such as a
room or a floor in a building. Each wire has the same maximum bit bandwidth, typically 100
Mb/s or 1 GB/s. One end is attached to an adapter on a host, and the other end is attached to a
port on the hub. A hub slavishly copies every bit that it receives on each port to every other port.
Thus, every host sees every bit. Each Ethernet adapter has a globally unique 48-bit address that is
stored in a non-volatile memory on the adapter. A host can send a chunk of bits called a frame to
any other host on the segment. Each frame includes some fixed number of header bits that
identify the source and destination of the frame and the frame length, followed by a payload of
data bits.
Every host adapter sees the frame, but only the destination host actually reads it. Multiple
Ethernet segments can be connected into larger LANs, called bridged Ethernets, using a set of
wires and small boxes called bridges, as shown in Figure 11.4. Bridged Ethernets can span entire
buildings or campuses. In a bridged Ethernet, some wires connect bridges to bridges, and others
connect bridges to hubs. The bandwidths of the wires can be different. In our example, the
bridge–bridge wire has a 1 GB/s bandwidth, while the four hub–bridge wires have bandwidths of
100 Mb/s

Bridges make better use of the available wire bandwidth than hubs. Using a clever distributed
algorithm, they automatically learn over time which hosts are reachable from which ports, and
then selectively copy frames from one port to another only when it is necessary. For example, if
host A sends a frame to host B, which is on the segment, then bridge X will throw away the
frame when it arrives at its input port, thus saving bandwidth on the other segments. However, if
host A sends a frame to host C on a different segment, then bridge X will copy the frame only to
the port connected to bridge Y, which will copy the frame only to the port connected to bridge
C‟s segment. To simplify our pictures of LANs, we will draw the hubs and bridges and the wires
that connect them as single horizontal line, as shown in Figure 11.5.
At a higher level in the hierarchy, multiple incompatible LANs can be connected by specialized
computers called routers to form an internet (interconnected network).

Each router has an adapter (port) for each network that it is connected to. Routers can also
connect high- speed point-to-point phone connections, which are examples of networks known
as WANs (Wide-Area Networks), so called because they span larger geographical areas than
LANs. In general, routers can be used to build internets from arbitrary collections of LANs and
WANs. For example, Figure 11.6 shows an example internet with a pair of LANs and WANs
connected by three routers.

You might also like