0% found this document useful (0 votes)
11 views

NWProg S23

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)
11 views

NWProg S23

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/ 68

Spring 2023 (3)

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:

Dr. Hatem Yousry


• “what’s the time?” • Machines rather than
humans
• “I have a question” • All communication
• Introductions activity in Internet
• governed by 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

• The Internet Layer.


• The Transport Layer.
• The Application Layer.
• The Host-to-Network Layer. (MAC and Physical)

22
TCP/IP Network

23
The Internet Layer

• The internet layer defines an official packet format and


protocol called IP (Internet Protocol).
• The job of the internet layer is to deliver IP packets where
they are supposed to go. Packet routing is clearly the
major issue here, as is avoiding congestion. For these
reasons, it is reasonable to say that the TCP/IP internet
layer is similar in functionality to the OSI network layer.

24
The Transport Layer

• The layer above the internet layer in the TCP/IP model is


now usually called the transport layer.
• It is designed to allow peer entities on the source and
destination hosts to carry on a conversation, just as in the
OSI transport layer.
• Two end-to-end transport protocols have been defined here.
• The first one, TCP (Transmission Control Protocol), is a
reliable connection-oriented protocol that allows a byte
stream originating on one machine to be delivered without
error on any other machine in the internet. It fragments the
incoming byte stream into discrete messages and passes
each one on to the internet layer.
• At the destination, the receiving TCP process reassembles
the received messages into the output stream. TCP also
handles flow control to make sure a fast sender cannot
swamp a slow receiver with more messages than it can
handle. 25
• TCP's sequencing or flow control.
The Transport Layer

• The second protocol in this layer, UDP (User Datagram


Protocol), is an unreliable, connectionless protocol for
applications that do not want TCP's sequencing or flow
control and wish to provide their own.
• It is also widely used for one-shot, client-server-type
request-reply queries and applications in which prompt
delivery is more important than accurate delivery, such as
transmitting speech or video.

26
The Application Layer

• The TCP/IP model does not have session or presentation


layers.
• On top of the transport layer is the application layer. It
contains all the higher-level protocols. The early ones
included virtual terminal (TELNET), file transfer (FTP), and
electronic mail (SMTP).
• The virtual terminal protocol allows a user on one
machine to log onto a distant machine and work there.
• The f ile transfer protocol (FTP) provides a way to move
data ef fic iently from one machine to another. Electronic
mail was originally just a kind of f ile transfer, but later a
specialized protocol (SMTP) was developed for it.
• Many other protocols have been added to these over the
years: the Domain Name System (DNS) for mapping host
names onto their network addresses, NNTP, the protocol
for moving USENET news articles around, and HTTP, the 27
protocol for fetching pages on the World Wide Web, and
many others.
The Host-to-Network Layer

• Below the internet layer is a great void. The TCP/IP


reference model does not really say much about what
happens here, except to point out that the host has to
connect to the network using some protocol so it can
send IP packets to it.
• This protocol is not def ined and varies from host to host
and network to network. Books and papers about the
TCP/IP model rarely discuss it.
• It is contains the MAC control and the raw bits in the
physical layer.

28
TCP/IP Encapsulation

29
The Internet Architecture TCP/IP

30
The Internet Architecture TCP/IP

FTP HTTP TFTP DNS

TCP UDP

IP

Net 1 Net 1
Ethernet
FDDI

FTP: File Transfer Protocol TCP: Transmission Control Protocol


31
HTTP: Hypertext Transport Protocol UDP: User Datagram Protocol
TFTP: Trivial File Transfer Protocol IP: Internet Protocol
TCP/IP Architecture

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.)

Centralized processing Distributed processing


A host computer (often a mainframe) A number of computers (minis,
handls all processing, workstations, PCs, ...) handle all 42
including input, output, data storage and processing,
retrieval They are distributed physically and
connected thru a communications
Decentralized Processing
• Computer systems in different locations.
• It is the allocation of resources, both hardware and
software, to each individual workstation, or office location.
• Although data may be transmitted between the
computers periodically, it implies limited daily
communications. Contrast with distributed computing
and centralized processing.

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)

• H ype r te x t Tra nsf e r P ro to c o l S e c ure ( https) is a


combination of the Hypertext Transfer Protocol (HTTP)
with the Secure Socket Layer (SSL)/Transport Layer
Security (TLS) protocol.
• TLS is an authentication and security protocol widely
implemented in browsers and Web servers.
• Integrity and Authentication: Through encryption and
authentication, HTTPS protects the integrity of
communication between a website and a user's browsers.
Your users will know that the data sent from your web
server has not been intercepted and/or altered by a third
party in transit.
47
The Hyper Text Markup Language
(HTML)
• It stands for Hyper Text Markup language, it represents a way to take
ordinary text and turn into Hyper Text, just by adding special elements
called mark-up tags that tell web browsers how to display a web page
contents.
• The main goal of HTML is to be a universal language for classifying the
function of different sections of a document. It is designed to work on a
wide variety of platform .
• HTML shares some important characteristics with its SGML (Standard
Generalized Markup Language) parent: HTML is one member of a family
of markup languages called SGML.
1. A character-based method for describing and expressing content.
2. A desire to deliver that content equally to multiple platforms.
3. A method for linking document components together to compose
compound documents.
• HTML have different versions:
1. HTML+
2. HTML 2.0
3. HTML 3.2
4. HTML4.0 48
A simple HTML f ile
• <!DOCTYPE html>
• <html>
• <head>
• <title>Example Domain</title>
• </head>
• <body>
• <h1>Example Domain</h1>
• <p>This domain is to be used for illustrative examples in
documents.</p>
• </body>
• </html>
49
Uniform Resource Locator (URL)
• It is a string of characters that specify the address of a web page. A client that
wants to access a web page needs an address. This address of a web page is
known as URL. The URL provides an addressing scheme which allows the
browser to request just about any document or web page located anywhere on
that document. A URL normally takes the form:
• <protocol>://<web-server name>/<directory-name>/<file-name> or
• http://www.yahoo.com/education/index.html
• The f irst part of URL specif ies the transfer protocol starting at the leftmost
portion of URL up to colon (:) tells the browser what type of server it will
connect to and which protocol to use in order to retrieve / access the document,
that is always represented by "//".
• The second part of URL is full qualif ied domain name(FQDN) .It identif ies the
site running the server that controls the webpage the URL points to many sites.
• The third part of URL identif ies the full path name for a particular web page.
The pathname is always preceded by single slash after the domain name.
• Example:-http://www.microsoft.com/IE/index.html
• There are two types of URL
1. Absolute URL use a complete Internet address to give the location of a
resource.
2. Relative URL is not fully qualif ied but rather it inherits the protocol, host and 50
p a t h i n f o r m a t i o n f r o m i t s p a r e n t d o c u m e n t .
Internet Servers/ Web servers

• 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.

• Need to define the network architecture, protocols,


applications, interfaces, policies, usages.

• 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

• Multiple access: All nodes share the same physical


medium

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

Dr. Hatem Yousry


Network Programming
Dr. Hatem Yousry
67
E-mail: [email protected]
Network Programming Dr. Hatem
68

Yousry

You might also like