SlideShare a Scribd company logo
1
Advanced Computer Networks
Lecture No. 3
Protocol Machinery
Multiplexing and Demultiplexing (demux key)
Encapsulation (header/body) in peer-to-peer interfaces
indirect communication (except at hardware level)
each protocol adds a header
part of header includes demultiplexing field (e.g., pass up to
request/reply or to message stream?)
4
Encapsulation
Host 1 Host 2
Application
program
Application
program
Data Data
RRP RRP
RRP Data RRP Data
HHP HHP
RRP Data
HHP
5
Message Transmission Using Layers
6
Standard Architectures
• Open System Interconnect (OSI) Architecture
– International Standards Organization (ISO)
– International Telecommunications Union (ITU),
formerly CCITT
– “X dot” series: X.25, X.400, X.500
– Primarily a reference model
7
OSI Architecture
Application
Presentation
Session
Transport
End host
One or more nodes
within the network
Network
Data link
Physical
Network
Data link
Physical
Network
Data link
Physical
Application
Presentation
Session
Transport
End host
Network
Data link
Physical
Application
Data formatting
Connection management
Process-to-process
communication channel
Host-to-host packet
delivery
Framing of data bits
Transmission of raw bits
User
level
OS
kernel
8
Internet Architecture
• TCP/IP Architecture
– Developed with ARPANET and NSFNET
– Internet Engineering Task Force (IETF)
• Culture: implement, then standardize
• OSI culture: standardize, then implement
– Became popular with release of Berkeley Software
Distribution (BSD) Unix; i.e. free software
– Standard suggestions traditionally debated publically
through “Request For Comments” (RFC’s)
9
Internet Architecture
• Implementation and design done together
• Hourglass Design (bottleneck is IP)
• Application vs Application Protocol (FTP, HTTP)
… NETn
NET2
NET1
IP
TCP UDP
FTP HTTP NV TFTP
10
Internet Architecture
• Layering is not very strict
Application
TCP UDP
IP
Network
11
Network Models
12
How Layers Fit Together in Practice
13
Networking in the Internet Age
14
Protocol Acronyms
• (T)FTP – (Trivial) File Transfer Protocol
• HTTP – Hyper Text Transport Protocol
• NV – Network Video
• SMTP – Simple Mail Transfer Protocol
• NTP – Network Time Protocol
• TCP – Transmission Control Protocol
• UDP – User Datagram Protocol
• IP – Internet Protocol
• FDDI – Fiber Distributed Data Interface
• ATM – Asynchronous Transfer Mode
15
Elements of a Protocol
Implementation
• Outline
– Service Interface
– Process Model
– Common Subroutines
– Example Protocol
16
Network Software
• Major factors for runaway success of the Internet:
– most functionalities provided by software running on
general-purpose computers
• new services can be added readily with just a small
matter of programming
• Understanding how to implement network software
is essential to understand computer networks
17
Network Application Programming
Interface (API)
• Interface that the OS provides to its networking
subsystem
– most network protocols are implemented in software
– all systems implement network protocols as part of the OS
– each OS is free to define its own network API
– applications can be ported from one OS to another if APIs are
similar
• *IF* application program does not interact with other parts
of the OS other than the network (file system, fork
processes, display …)
18
Protocols and API
• Protocols provide a certain set of
services
• API provides a syntax by which those
services can be invoked
• Implementation is responsible for
mapping API syntax onto protocol
services
19
Socket API
• Use sockets as “abstract endpoints” of
communication
• Issues
– Creating & identifying sockets
– Sending & receiving data
• Mechanisms
– UNIX system calls and library routines
socket
process
20
Socket API
• Creating a socket
int socket(int domain, int type, int protocol)
• domain (family) = AF_INET, PF_UNIX, AF_OSI
• type = SOCK_STREAM, SOCK_DGRAM
• protocol = TCP, UDP, UNSPEC
• return value is a handle for the newly created
socket
21
Sockets (cont)
• Passive Open (on server)
int bind(int socket, struct sockaddr *addr, int
addr_len)
int listen(int socket, int backlog)
int accept(int socket, struct sockaddr *addr, int
addr_len)
• Active Open (on client)
int connect(int socket, struct sockaddr *addr,
int addr_len)
22
Sockets (cont)
• Sending Messages
int send(int socket, char *msg, int mlen, int
flags)
• Receiving Messages
int recv(int socket, char *buf, int blen, int flags)
23
Protocol-to-Protocol Interface
• A protocol interacts with a lower level protocol like
an application interacts with underlying network
• Why not using available network APIs for PPI ?
– Inefficiencies built into the socket interface
• application programmer tolerate them to simplify
their task
– inefficiency at one level
• protocol implementers do not tolerate them
– inefficiencies at several layers of protocols
24
Protocol-to-Protocol Interface Issues
• Configure multiple layers
– static versus extensible
• Process Model
– avoid context switches
• Buffer Model
– avoid data copies
25
Process Model
(a) (b)
Process-per-Protocol Process-per-Message
inter-process
communication
procedure
call
26
Process Model (cont.)
IP
TCP
send(IP, message) deliver(TCP, message)
int send(Protocol llp, Msg *message)
int deliver(Protocol hlp, Msg *message)
27
Buffer Model
send()
deliver()
Topmost protocol
Application process
buffer copy buffer copy
28
Message Library
• Add header
abcdefg
bcopy (“ xyz” , hdr , 3);
msgAddHdr(m, hdr, 3);
xyzabcdefg
m
m
abcdefg
hdr =msgStripHdr(m, 3);
defg + hdr = “ abc”
m
m
• Strip header
29
Message Library (cont)
• Fragment message
new
m
m
abcdefg
defg + abc
msgFragment (m, new, 3);
m1 m2
new
abcd efg
msgReassemble(new, m1, m2)
• Reassemble messages
abcdefg
30
Network Programming
• Things to learn
– Internet protocols (IP, TCP, UDP, …)
– Sockets API (Application Programming Interface)
• Why IP and sockets
• allows a common name space across most of Internet
– IP (Internet Protocol) is standard
• reduces number of translations, which incur
overhead
– Sockets: reasonably simple and elegant Unix interface
(most servers run Unix)
31
OSI Model Internet Protocols
…
physical
data link
network
transport
application layers TFTP
NV
HTTP
FTP
UDP
TCP
IP
FDDI Ethernet ATM
32
• learn to use Internet for
communication (with
focus on implementation
of networking concepts)
• learn to build network
from ground up
physical
data link
network
transport
Programming
Principles
and concepts
33
Socket Programming
• Reading: Stevens 2nd edition, Chapter 1-6
• Sockets API: a transport layer service interface
– introduced in 1981 by BSD 4.1
– implemented as library and/or system calls
– similar interfaces to TCP and UDP
– can also serve as interface to IP (for super-user);
known as “raw sockets”
– Linux also provides interface to MAC layer (for super-
user); known as “data-link sockets”
34
Outline
• Client-server model
• TCP connections
• UDP services
• Addresses and data
• Sockets API
• Example of usage
35
Client-Server Model
• Asymmetric relationship
• Server/daemon
– well-known name
– waits for contact
– process requests, sends
replies
• Client
– initiates contact
– waits for response
server
client client
client
36
Client-Server Model
• Bidirectional communication channel
• Service models
– sequential: server processes only one client’s requests at
a time
– concurrent: server processes multiple clients’ requests
simultaneously
– hybrid: server maintains multiple connections, but
processes requests sequentially
• Server and client categories not disjoint
– server can be client of another server
– server as client of its own client (peer-to-peer
architecture)
37
Review Lecture 3
• Protocol Machinery - Encapsulation
• Standard architectures: OSI, Internet
• Network models and layering
• Elements of protocol implementation
• Network software
• Network API – Socket API – PPI
• Process and buffer model
• Programming – Client server model

More Related Content

Similar to Advanced Computer Networks Lecture 3.ppt (20)

PPTX
Lecture 3 computer communications and networks
anasbro009
 
PPT
02 protocols and tcp-ip
myl_1116
 
PPT
Skr+3200+chapter+2+(kweh)
Ammar Shafiq
 
PPT
02 protocols and tcp-ip
kashish0313
 
PPTX
6. Chapter_2_1_newversion1.pptxasasasdasdasda
UsamaMushtaq15
 
PPTX
Computer network coe351- part2- final
Taymoor Nazmy
 
PDF
chapter07 - The Internet.pdf
satonaka3
 
PDF
The-OSI-and-TCPIP-Models protocol suit.pdf
FasikaGetachew3
 
PPT
CN unit 1 part 2 2023.ppt
mohanravi1986
 
PDF
CS6551 COMPUTER NETWORKS
Kathirvel Ayyaswamy
 
PPTX
clg_assgn.pptx
AjayMishra617858
 
PDF
Introduction_to_RoutingThere are many types of routers some of them are discu...
click2shahpk
 
PPTX
Automation Networking By Shivam Singh
Shivam Singh
 
PPT
Osi model 7 Layers
Siddique Ibrahim
 
PDF
network basics
Avin Ash
 
PPT
MK-PPT Chapter 1.ppt
NuthanR3
 
PPTX
OSI model.pptx
SmtArunaAsafAliGovtP
 
PPT
Week_1_Intro_Internet_arch_Applications.ppt
home107
 
PPSX
Network protocols and Java programming
difatta
 
PPTX
Web technologies: recap on TCP-IP
Piero Fraternali
 
Lecture 3 computer communications and networks
anasbro009
 
02 protocols and tcp-ip
myl_1116
 
Skr+3200+chapter+2+(kweh)
Ammar Shafiq
 
02 protocols and tcp-ip
kashish0313
 
6. Chapter_2_1_newversion1.pptxasasasdasdasda
UsamaMushtaq15
 
Computer network coe351- part2- final
Taymoor Nazmy
 
chapter07 - The Internet.pdf
satonaka3
 
The-OSI-and-TCPIP-Models protocol suit.pdf
FasikaGetachew3
 
CN unit 1 part 2 2023.ppt
mohanravi1986
 
CS6551 COMPUTER NETWORKS
Kathirvel Ayyaswamy
 
clg_assgn.pptx
AjayMishra617858
 
Introduction_to_RoutingThere are many types of routers some of them are discu...
click2shahpk
 
Automation Networking By Shivam Singh
Shivam Singh
 
Osi model 7 Layers
Siddique Ibrahim
 
network basics
Avin Ash
 
MK-PPT Chapter 1.ppt
NuthanR3
 
OSI model.pptx
SmtArunaAsafAliGovtP
 
Week_1_Intro_Internet_arch_Applications.ppt
home107
 
Network protocols and Java programming
difatta
 
Web technologies: recap on TCP-IP
Piero Fraternali
 

Recently uploaded (20)

PDF
Lesson 2 - WATER,pH, BUFFERS, AND ACID-BASE.pdf
marvinnbustamante1
 
PDF
Dimensions of Societal Planning in Commonism
StefanMz
 
PPTX
Quarter1-English3-W4-Identifying Elements of the Story
FLORRACHELSANTOS
 
PDF
0725.WHITEPAPER-UNIQUEWAYSOFPROTOTYPINGANDUXNOW.pdf
Thomas GIRARD, MA, CDP
 
PPTX
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
PPTX
How to Manage Large Scrollbar in Odoo 18 POS
Celine George
 
PDF
DIGESTION OF CARBOHYDRATES,PROTEINS,LIPIDS
raviralanaresh2
 
PDF
The dynastic history of the Chahmana.pdf
PrachiSontakke5
 
PPTX
PATIENT ASSIGNMENTS AND NURSING CARE RESPONSIBILITIES.pptx
PRADEEP ABOTHU
 
PPTX
BANDHA (BANDAGES) PPT.pptx ayurveda shalya tantra
rakhan78619
 
PPTX
How to Create a PDF Report in Odoo 18 - Odoo Slides
Celine George
 
PDF
LAW OF CONTRACT ( 5 YEAR LLB & UNITARY LLB)- MODULE-3 - LEARN THROUGH PICTURE
APARNA T SHAIL KUMAR
 
PPTX
How to Convert an Opportunity into a Quotation in Odoo 18 CRM
Celine George
 
PPTX
Stereochemistry-Optical Isomerism in organic compoundsptx
Tarannum Nadaf-Mansuri
 
PPTX
Pyhton with Mysql to perform CRUD operations.pptx
Ramakrishna Reddy Bijjam
 
PPTX
MENINGITIS: NURSING MANAGEMENT, BACTERIAL MENINGITIS, VIRAL MENINGITIS.pptx
PRADEEP ABOTHU
 
PDF
LAW OF CONTRACT (5 YEAR LLB & UNITARY LLB )- MODULE - 1.& 2 - LEARN THROUGH P...
APARNA T SHAIL KUMAR
 
PDF
Isharyanti-2025-Cross Language Communication in Indonesian Language
Neny Isharyanti
 
PDF
People & Earth's Ecosystem -Lesson 2: People & Population
marvinnbustamante1
 
PDF
CEREBRAL PALSY: NURSING MANAGEMENT .pdf
PRADEEP ABOTHU
 
Lesson 2 - WATER,pH, BUFFERS, AND ACID-BASE.pdf
marvinnbustamante1
 
Dimensions of Societal Planning in Commonism
StefanMz
 
Quarter1-English3-W4-Identifying Elements of the Story
FLORRACHELSANTOS
 
0725.WHITEPAPER-UNIQUEWAYSOFPROTOTYPINGANDUXNOW.pdf
Thomas GIRARD, MA, CDP
 
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
How to Manage Large Scrollbar in Odoo 18 POS
Celine George
 
DIGESTION OF CARBOHYDRATES,PROTEINS,LIPIDS
raviralanaresh2
 
The dynastic history of the Chahmana.pdf
PrachiSontakke5
 
PATIENT ASSIGNMENTS AND NURSING CARE RESPONSIBILITIES.pptx
PRADEEP ABOTHU
 
BANDHA (BANDAGES) PPT.pptx ayurveda shalya tantra
rakhan78619
 
How to Create a PDF Report in Odoo 18 - Odoo Slides
Celine George
 
LAW OF CONTRACT ( 5 YEAR LLB & UNITARY LLB)- MODULE-3 - LEARN THROUGH PICTURE
APARNA T SHAIL KUMAR
 
How to Convert an Opportunity into a Quotation in Odoo 18 CRM
Celine George
 
Stereochemistry-Optical Isomerism in organic compoundsptx
Tarannum Nadaf-Mansuri
 
Pyhton with Mysql to perform CRUD operations.pptx
Ramakrishna Reddy Bijjam
 
MENINGITIS: NURSING MANAGEMENT, BACTERIAL MENINGITIS, VIRAL MENINGITIS.pptx
PRADEEP ABOTHU
 
LAW OF CONTRACT (5 YEAR LLB & UNITARY LLB )- MODULE - 1.& 2 - LEARN THROUGH P...
APARNA T SHAIL KUMAR
 
Isharyanti-2025-Cross Language Communication in Indonesian Language
Neny Isharyanti
 
People & Earth's Ecosystem -Lesson 2: People & Population
marvinnbustamante1
 
CEREBRAL PALSY: NURSING MANAGEMENT .pdf
PRADEEP ABOTHU
 
Ad

Advanced Computer Networks Lecture 3.ppt

  • 3. Protocol Machinery Multiplexing and Demultiplexing (demux key) Encapsulation (header/body) in peer-to-peer interfaces indirect communication (except at hardware level) each protocol adds a header part of header includes demultiplexing field (e.g., pass up to request/reply or to message stream?)
  • 4. 4 Encapsulation Host 1 Host 2 Application program Application program Data Data RRP RRP RRP Data RRP Data HHP HHP RRP Data HHP
  • 6. 6 Standard Architectures • Open System Interconnect (OSI) Architecture – International Standards Organization (ISO) – International Telecommunications Union (ITU), formerly CCITT – “X dot” series: X.25, X.400, X.500 – Primarily a reference model
  • 7. 7 OSI Architecture Application Presentation Session Transport End host One or more nodes within the network Network Data link Physical Network Data link Physical Network Data link Physical Application Presentation Session Transport End host Network Data link Physical Application Data formatting Connection management Process-to-process communication channel Host-to-host packet delivery Framing of data bits Transmission of raw bits User level OS kernel
  • 8. 8 Internet Architecture • TCP/IP Architecture – Developed with ARPANET and NSFNET – Internet Engineering Task Force (IETF) • Culture: implement, then standardize • OSI culture: standardize, then implement – Became popular with release of Berkeley Software Distribution (BSD) Unix; i.e. free software – Standard suggestions traditionally debated publically through “Request For Comments” (RFC’s)
  • 9. 9 Internet Architecture • Implementation and design done together • Hourglass Design (bottleneck is IP) • Application vs Application Protocol (FTP, HTTP) … NETn NET2 NET1 IP TCP UDP FTP HTTP NV TFTP
  • 10. 10 Internet Architecture • Layering is not very strict Application TCP UDP IP Network
  • 12. 12 How Layers Fit Together in Practice
  • 13. 13 Networking in the Internet Age
  • 14. 14 Protocol Acronyms • (T)FTP – (Trivial) File Transfer Protocol • HTTP – Hyper Text Transport Protocol • NV – Network Video • SMTP – Simple Mail Transfer Protocol • NTP – Network Time Protocol • TCP – Transmission Control Protocol • UDP – User Datagram Protocol • IP – Internet Protocol • FDDI – Fiber Distributed Data Interface • ATM – Asynchronous Transfer Mode
  • 15. 15 Elements of a Protocol Implementation • Outline – Service Interface – Process Model – Common Subroutines – Example Protocol
  • 16. 16 Network Software • Major factors for runaway success of the Internet: – most functionalities provided by software running on general-purpose computers • new services can be added readily with just a small matter of programming • Understanding how to implement network software is essential to understand computer networks
  • 17. 17 Network Application Programming Interface (API) • Interface that the OS provides to its networking subsystem – most network protocols are implemented in software – all systems implement network protocols as part of the OS – each OS is free to define its own network API – applications can be ported from one OS to another if APIs are similar • *IF* application program does not interact with other parts of the OS other than the network (file system, fork processes, display …)
  • 18. 18 Protocols and API • Protocols provide a certain set of services • API provides a syntax by which those services can be invoked • Implementation is responsible for mapping API syntax onto protocol services
  • 19. 19 Socket API • Use sockets as “abstract endpoints” of communication • Issues – Creating & identifying sockets – Sending & receiving data • Mechanisms – UNIX system calls and library routines socket process
  • 20. 20 Socket API • Creating a socket int socket(int domain, int type, int protocol) • domain (family) = AF_INET, PF_UNIX, AF_OSI • type = SOCK_STREAM, SOCK_DGRAM • protocol = TCP, UDP, UNSPEC • return value is a handle for the newly created socket
  • 21. 21 Sockets (cont) • Passive Open (on server) int bind(int socket, struct sockaddr *addr, int addr_len) int listen(int socket, int backlog) int accept(int socket, struct sockaddr *addr, int addr_len) • Active Open (on client) int connect(int socket, struct sockaddr *addr, int addr_len)
  • 22. 22 Sockets (cont) • Sending Messages int send(int socket, char *msg, int mlen, int flags) • Receiving Messages int recv(int socket, char *buf, int blen, int flags)
  • 23. 23 Protocol-to-Protocol Interface • A protocol interacts with a lower level protocol like an application interacts with underlying network • Why not using available network APIs for PPI ? – Inefficiencies built into the socket interface • application programmer tolerate them to simplify their task – inefficiency at one level • protocol implementers do not tolerate them – inefficiencies at several layers of protocols
  • 24. 24 Protocol-to-Protocol Interface Issues • Configure multiple layers – static versus extensible • Process Model – avoid context switches • Buffer Model – avoid data copies
  • 25. 25 Process Model (a) (b) Process-per-Protocol Process-per-Message inter-process communication procedure call
  • 26. 26 Process Model (cont.) IP TCP send(IP, message) deliver(TCP, message) int send(Protocol llp, Msg *message) int deliver(Protocol hlp, Msg *message)
  • 28. 28 Message Library • Add header abcdefg bcopy (“ xyz” , hdr , 3); msgAddHdr(m, hdr, 3); xyzabcdefg m m abcdefg hdr =msgStripHdr(m, 3); defg + hdr = “ abc” m m • Strip header
  • 29. 29 Message Library (cont) • Fragment message new m m abcdefg defg + abc msgFragment (m, new, 3); m1 m2 new abcd efg msgReassemble(new, m1, m2) • Reassemble messages abcdefg
  • 30. 30 Network Programming • Things to learn – Internet protocols (IP, TCP, UDP, …) – Sockets API (Application Programming Interface) • Why IP and sockets • allows a common name space across most of Internet – IP (Internet Protocol) is standard • reduces number of translations, which incur overhead – Sockets: reasonably simple and elegant Unix interface (most servers run Unix)
  • 31. 31 OSI Model Internet Protocols … physical data link network transport application layers TFTP NV HTTP FTP UDP TCP IP FDDI Ethernet ATM
  • 32. 32 • learn to use Internet for communication (with focus on implementation of networking concepts) • learn to build network from ground up physical data link network transport Programming Principles and concepts
  • 33. 33 Socket Programming • Reading: Stevens 2nd edition, Chapter 1-6 • Sockets API: a transport layer service interface – introduced in 1981 by BSD 4.1 – implemented as library and/or system calls – similar interfaces to TCP and UDP – can also serve as interface to IP (for super-user); known as “raw sockets” – Linux also provides interface to MAC layer (for super- user); known as “data-link sockets”
  • 34. 34 Outline • Client-server model • TCP connections • UDP services • Addresses and data • Sockets API • Example of usage
  • 35. 35 Client-Server Model • Asymmetric relationship • Server/daemon – well-known name – waits for contact – process requests, sends replies • Client – initiates contact – waits for response server client client client
  • 36. 36 Client-Server Model • Bidirectional communication channel • Service models – sequential: server processes only one client’s requests at a time – concurrent: server processes multiple clients’ requests simultaneously – hybrid: server maintains multiple connections, but processes requests sequentially • Server and client categories not disjoint – server can be client of another server – server as client of its own client (peer-to-peer architecture)
  • 37. 37 Review Lecture 3 • Protocol Machinery - Encapsulation • Standard architectures: OSI, Internet • Network models and layering • Elements of protocol implementation • Network software • Network API – Socket API – PPI • Process and buffer model • Programming – Client server model