NWProg S23
NWProg S23
Yousry
Dr. Hatem
Network Programming
Network Programming 1
Dr. Hatem Yousry
Agenda
• Layering Abstraction.
• Network Protocols.
Yousry
Dr. Hatem
• The Open Systems Interconnection model
(OSI model).
Network Programming
• TCP/IP Internet Model.
2
Layering Abstraction
• Layer: A set of functionalities encapsulated in an object that
can be used by other network components
• Example: The network layer implements the end-to-end packet
delivery
• Why layering? Think complexity and common services
• Layers consist of protocols
3
A simple layering example
• Two Internet hosts connected
via two routers and the
corresponding layers used at
each hop.
• The application on each host
executes read and write
operations as if the processes
were directly connected to
each other by some kind of
data pipe.
• Every other detail of the
communication is hidden from
each process.
• The underlying mechanisms
that transmit data between the
host computers are located in 4
the lower protocol layers.
Looking into layers a bit closer
• Protocols in each layer have
• Service interface with upper layer/lower layer
• Peer-to-peer interface with host on same layer
5
Hierarchical Layer Structure
• Layering implies the use of a layer hierarchy
6
Network Protocols
• Network protocols are formal standards and policies
comprised of rules, procedures and formats that def ine
communication between two or more devices over a
network. Network protocols govern the end-to-end
processes of timely, secure and managed data or network
communication.
• Netw o rk pro to c o ls inc o rpo rate all the pro c esses,
re q u i re m e n t s a n d c o n s t ra i n t s o f i n i t i a t i n g a n d
accomplishing communication between computers,
servers, routers and other network enabled devices.
• Network protocols must be confirmed and installed by the
se nde r and re c e iv e r to e nsure ne tw o rk/data
communication and apply to software and hardware 7
nodes that communicate on a network.
Network Protocols
8
Network Protocols
9
What is a protocol?
• Human protocols: • Network protocols:
Network Programming
… specific msgs
sent • Protocols define
format, order of msgs
… specific actions sent and received
taken when msgs among network
received, or other entities, and actions
taken on msg
events transmission, receipt
10
11
Message Exchange
12
The Open Systems
Interconnection model (OSI model)
• OSI model is a conceptual model that characterizes and
standardizes the communication functions of a
telecommunication or computing system without regard
to its underlying internal structure and technology.
• Its goal is the interoperability of diverse communication
systems with standard protocols. The model partitions a
communication system into abstraction layers. The
original version of the model defined seven layers.
13
The OSI Network Architecture
• OSI: Open Systems
Interconnection.
• 7 layers have a
protocol
specifications for
each layer.
• Acts like a reference
model rather than a
real-world protocol
graph.
• First three layers are
implemented in all 14
nodes.
The OSI Network Architecture
15
The OSI Network Architecture
16
Layers of the OSI model
• The OSI model has seven layers. The principles that were
applied to arrive at the seven layers can be briefly summarized
as follows:
1. A layer should be created where a different abstraction is
needed.
2. Each layer should perform a well-defined function.
3. The function of each layer should be chosen with an eye
toward defining internationally standardized protocols.
4. The layer boundaries should be chosen to minimize the
information flow across the interfaces.
5. The number of layers should be large enough that distinct
functions need not be thrown together in the same layer out
of necessity and small enough that the architecture does not 17
become unwieldy.
Layers of the OSI model
• Physical Layer: Transmission/reception of raw bits.
• Data Link Layer: Maps bits into frames, enable sharing of
common medium, corrects/detects errors , re-orders frames.
• Network Layer: Routes packets to destination, may perform
fragmentation and re-assembly.
• Transport Layer: Flow (congestion) control, error control,
transparent transport to upper layers.
• Session Layer: Establishes connection among hosts, duplex,
half-duplex, graceful connection termination, combination of
streams.
• Presentation Layer: Negotiation of format of data exchanged
between hosts.
• Application layer: Application services such as FTP, X.400 18
(mail), HTTP.
OSI Encapsulation
• Each OSI (open system interconnection) model
layer adds a header to the packet.
19
Data Encapsulation
• The middle section of the frame is payload data including
any headers for other protocols (for example, Internet
Protocol) carried in the frame. The frame ends with a
frame check sequence (FCS), which is cyclic redundancy
check used to detect any in-transit corruption of data.
• CRC uses Generator Polynomial which is available on
both sender and receiver side.
20
TCP/IP Internet Model
• The TCP/IP Internet protocols, a common example,
consist of:
• Transmission Control Protocol (TCP), which uses a set of
rules to exchange messages with other Internet points at
the information packet level.
• Internet Protocol (IP), which uses a set of rules to send
and receive messages at the Internet address level.
21
The Internet Architecture TCP/IP
22
TCP/IP Network
23
The Internet Layer
24
The Transport Layer
26
The Application Layer
28
TCP/IP Encapsulation
29
The Internet Architecture TCP/IP
30
The Internet Architecture TCP/IP
TCP UDP
IP
Net 1 Net 1
Ethernet
FDDI
32
Network Common Services
• In c o mpute r ne tw o rking, a ne tw o rk se rv ic e is an
application running at the network application layer and
abo v e , that pro v ide s data sto rage , manipulatio n,
presentation, communication or other capability which is
often implemented using a client-server or peer-to-peer
architecture based on application layer network protocols.
• Each service is usually provided by a server component
running on one or more computers (often a dedicated
server computer offering multiple services) and accessed
via a network by client components running on other
devices. However, the client and server components can
both be run on the same machine.
• Clients and servers will often have a user interface, and 33
sometimes other hardware associated with it.
Network Common Services
34
TCP-IP Network Services
• Port numbers such as List of TCP and UDP port numbers.
• Many Internet Protocol-based services are associated with a
particular well-known port number which is standardized by
the Internet technical governance.
• For example, World-Wide-Web servers operate on port 80, and
email relay servers usually listen on port 25.
35
TCP versus UDP
• Different services use different packet transmission
techniques.
• In general, packets that must get through in the correct
order, without loss, use TCP, whereas real time services
where later packets are more important than older
packets use UDP.
• For example, file transfer requires complete accuracy and
so is normally done using TCP, and audio conferencing is
frequently done via UDP, where momentary glitches may
not be noticed.
• UDP lacks built-in network congestion avoidance and the
protocols that use it must be extremely carefully designed
to prevent network collapse. 36
37
38
39
Example
• What is the minimum and the maximum number of layers
for a network consisted of an Gamming Server and HTTP
Server and a few symmetrical Operating Systems PCs
Yousry
Dr. Hatem
• What are the layers functions in each case.
• Support your answer with examples and graphical
Network Programming
illustration. Then recommend the PC's processors and
generations.
40
Network Topology
• Network Topology is the schematic description of a
network arrangement, connecting various nodes(sender
and receiver) through lines of connection.
41
Client/Server Architecture
• Basic Definition:
• Server: provides services
• Client: requests for services
• Service: any resource (e.g., data, type defn, file, control,
object, CPU time, display device, etc.)
43
Internet Servers/ Web servers
• The working of world wide web is based on client-server technology.
• The Internet user using a software known as a web browser requests
a document located on the web. The browser makes the request to
the Internet host containing that document.
• A server is a computer that provides data to other computers.
• For example, a Web server may run Apache HTTP Server or Microsoft
IIS, which both provide access to websites over the Internet. A mail
server may run a program like Exim or iMail, which provides SMTP
services for sending and receiving email.
• Many networks contain one or more of the common server types:
• File servers. File servers store and distribute files.
• Print servers.
• Application servers.
• Web servers.
• Database servers.
• Virtual servers.
• Proxy servers.
• Monitoring and management servers. 44
Internet Protocols
• The flow of information is controlled by a protocol.
• The protocol used in this exchange is called HTTP. The
client, or the user or web browser makes the HTTP
request and is served by an HTTP server also known a
web server.
• Hypertext Transfer Protocol (HTTP) .
• The Hyper Text Markup Language (HTML).
• Uniform Resource Locator (URL).
45
Hypertext Transfer Protocol (HTTP)
• HTTP:- It is a set of rules or protocol that governs the transfer of
hypertext between two or more computers.
• The world wide web encompasses the universe of information that is
available via protocol HTTP.
• The exchange of information between client and server is controlled
by a protocol called HTTP. The protocol transfers data in form of text,
audio, video, images.
• HTTP is the underlying protocol used by WWW which def in es how
much are formatted and transmitted and what action web server take
in response to various commands.
• Example:-When you enter a URL in your web browser this actually
sends an HTTP command to the web server directing it to fetch and
transmit the requested web page.
46
Hypertext Transfer Protocol Secure (HTTPS)
• The web server is the program or machine that responds to that request,
and delivers the content of the page back to the user. This can be done
because every computer or device that connects to the internet has a
uniquely identifying number, called an Internet Protocol address, or IP
address for short.
• Internet Information Services (IIS) for Windows® Server is a f le xible,
secure and manageable Web server for hosting anything on the Web.
• Most commonly, IIS is used to host ASP.NET web applications and static
websites. It can also be used as an FTP server, host WCF (Windows
Communication Foundation) services, and be extended to host web
applications built on other platforms such as PHP. There are built-in 51
authentication options such as Basic, ASP.NET, and Windows auth.
52
Apache HTTP Server
• Apache HTTP Server is a free and open-source web
server that delivers web content through the internet. It is
commonly referred to as Apache and after development,
it quickly became the most popular HTTP client on the
web.
53
Google Web Server (GWS)
• Google Web Server (GWS) is proprietary web server
software that Google uses for its web infrastructure. GWS
is used exclusively inside Google's ecosystem for website
hosting.
• GWS is involved in almost every user-visible change to the
google.com site.
54
Network Architecture
• Network architecture is the design of a communication
network.
• It is a framework for the specification of a network's
physical components and their functional organization
and configuration, its operational principles and
procedures, as well as data formats use.
55
Network Architecture
56
Network Architecture
• The task of connecting nodes via links, so that nodes can
exchange information, reliably, timely, efficiently, safely,
privately, “greenly”, and with low cost.
• Network Architecture
Directly connected networks
Circuit-switched networks
Packet-switched Networks
57
Switching Schemes
• Broadcast
• Ethernet, token ring, FDDI
Yousry
Dr. Hatem
• Circuit switching
• PSPTN (circuit switching network)
Network Programming
• Packet switching
• IP (store-and-forward network)
• Message switching
• Store and forward with message queues
• Cell switching
• BISDN/ATM (fixed length cells)
58
Directly-Connected Networks
• Point-to-point links: Each node is directly connected to all
others via a link
point-to-point
multiple 59
access
Switched Networks
• Circuit-Switched terminal/
• A dedicated circuit is host
established across a set of
links
• Example: Telephone network
• Packet-Switched
• Data is split into blocks
called packets or messages.
• Store-and-forward strategy
• Switches: Store and forward
packets
60
Circuit-Switched Networks
• End-to-end permanent connection
• Dedicated path for communication
• No need for a destination address since a path is already
established
• Once communication is complete, connection is ended
and links are released.
61
Advantages of Circuit
Switching
• Guaranteed bandwidth (Quality of Service)
• Predictable bitrate and delay
• Good for delay-sensitive applications
• Reliable communication
• Rare packet loss
• Packets are delivered in order
• Simple data routing
• Forwarding based on time slot or frequency
(multiplexing)
• No need to inspect a packet header for address
• Low per-packet overhead
• Forwarding based on time slot or frequency 62
• No IP (and TCP/UDP) header on each packet
Transmission Control Protocol (TCP)
User Datagram Protocol (UDP)
Internet Protocol (IP)
Disadvantages of Circuit
Switching
• Wasted resources
• Bursty traffic leads to idle connection during silent
period
• Blocked connections
• Connection refused when resources are not
sufficient
• Unable to offer “okay” service to everybody
• Connection set-up delay
• No communication until the connection is set up
• Unable to avoid extra latency for small data
transfers
• Network state
• Network nodes must store per-connection
information
• Unable to avoid per-connection storage and state 63
Packet Switched Networks
• Data is divided into packets (messages)
• Each packet contains identification info (source/destination
address seq. number, etc)
• Packets traverse the network individually
• Use the destination address to forward packets
• May use more than one routes, nodes may store packets
temporarily
64
Advantages of Packet
Switching
• No wasted resources (not entirely true)
• Links are not reserved during idle period
• Multiplexing
• Frequency, time, statistical multiplexing
• Service
• More connections of lesser quality
• No blocking of users
• Adaptation
• Can adapt to network congestion and failures
65
Disadvantages of Packet
Switching
• No guaranteed bandwidth
• Harder to build applications requiring QoS
• Per packet overhead
• Need a header with source/dest. address, etc.
• Complex end-to-end control
• Packets can be lost, corrupted or delivered out-of-
order
• Delay and Congestion
• No congestion control, can lead to arbitrary
delays and packet drops
66
Thank You
Yousry