0% found this document useful (0 votes)
15 views28 pages

02-Related Concept in Computer Networks (1)

Uploaded by

Văn Hữu
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)
15 views28 pages

02-Related Concept in Computer Networks (1)

Uploaded by

Văn Hữu
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/ 28

RELATED CONCEPTS IN

COMPUTER NETWORKS
Content
• Computer Networks
• OSI and TCP/IP models
• IP
• Transport layer, TCP, UDP
• Network application models
• Socket concept
Computer Networks
mobile network
• Inter-connection of nodes by
transport medium following some global ISP
architecture:
• Using a topology: bus, star, ring,
home
hybrid… network
regional ISP
• Using some communication protocols

institutional
network
OSI and TCP/IP models
OSI model TCP/IP model

Application layer
Application
Presentation layer HTTP, FTP, SMTP…

Session layer
Transport layer Transport layer
Network layer Network layer
Datalink layer Datalink layer
Physical layer Physical layer
OSI and TCP/IP models
• Application layer: defines communication
between different parts of the same application
• Presentation layer: application data representation,
data encryption, compression, conversion…
• Session layer: manages sessions, synchronization,
Application
recovery of data transmission process Presentation
• Transport layer: Transmits data between
applications Session
• Network layer: Transmits data between distance Transport
network elements: Taking care of routing and
forwarding data Network
• Data link layer: Transmits data between adjacent Data link
network elements.
• Physical layer: Transmits bits on the medium. Physical
Converting bits to physical form appropriate to
the medium.
OSI and TCP/IP models
• OSI model: reference model
• TCP model: Internet model
• Transport layer: TCP/UDP
• Network layer: IP + routing protocols.
OSI and TCP/IP models

Application layer Application layer

Presentation layer Presentation layer

Session layer Session layer

Transport layer Transport layer

Network layer Network layer Network layer

Data link layer Data link layer

Physical layer Physical layer

Intermediate node End system


End system
Internet protocols mapping on TCP/IP
...
Aplication DNS DHCP SNMP HTTP SMTP FTP

Transport UDP TCP

...
ICMP RIP OSPF
Network IP

Ethernet FDDI PPP DSL ARP ...


Data link

Physical Copper Optical Radio PSTN ...


OSI and TCP/IP models
• Layering Makes it Easier
• Application programmer
• Doesn’t need to send IP packets
• Doesn’t need to send Ethernet frames
• Doesn’t need to know how TCP implements reliability

• Only need a way to pass the data down to transport layer


• Socket is the API to access transport layer functions
• A socket is a SAP of the transport layer.

Application layer Application layer


socket socket
Transport layer Transport layer

Network layer Network layer

Data link layer Data link layer

Physical layer Physical layer


IP
• IP: Internet Protocol
• Forward data packet between distance network nodes (routers or
hosts)
• Using routing table built by routing protocols such as OSPF, RIP …
• IP address
• Is assigned to each network interface
• IP v4: 32 bits
• 133.113.215.10
• IP v6: 128 bits
• 2001:200:0:8803::53

• A host may have a domain name


• Conversion IP <-> domain name: DNS
• Ex: soict.hust.edu.vn <--> 202.191.56.65
IP packet total datagram
length (words)
IP protocol version 32 bits
number
ver head. DS length
header length len for
(bytes) fragment
16-bit identifier flgs fragmentation/
offset reassembly
QoS support time to upper header
live layer checksum
max number 32 bit source IP address
remaining hops
32 bit destination IP address
(decremented at
each router) Options (if any) E.g. timestamp,
record route
data taken, specify
upper layer protocol (variable length, list of routers
to deliver payload to typically a TCP to visit.
or UDP segment)
11
12

Transport layer: Mux/Demux

HTTP FTP Chat Application HTTP FTP Chat


protocol
Transport layer
Multiplexing Demultiplexing
protocol

Network layer protocol


13

Transport layer: Mux/Demux


• How data from an application on 32 bits
one host can be delivered to the source port # dest port #
right application on another host?
• Each application process is
other header fields
assigned a transport port (16 bits)
• Application sends data to the
transport layer through the port.
Application data
• Socket: (message)
• Access point for Application on
transport layer functionalities
• It is a combination of (Address IP,
transportnport) TCP/UDP segment format
Transport layer: UDP
• MUX/DeMUX 32 bits
• Best effort source port # dest port #
• Connectionless length checksum
• Send independent datagrams
• Drop error datagrams
• No congestion control
Application
data
(message)
15

UDP mux/demux
Each process uses a port to communicate with other
process.
One process can communicate with several others
using UDP
Host B
Host A Host C
application
application P1 application
P2 P3
transport
transport transport
network
network link network
link physical link
physical physical

source port: 6428 source port: 6428


dest port: 9157 dest port: 5775

source port: 9157 source port: 5775


dest port: 6428 dest port: 6428
Transport layer: TCP
• Connection oriented protocol
• 3-step connection opening A B
• Reliable protocol
• Re-transmission on error
SYN
• Flow control
• Congestion control
ACK/SYN

AC K
Transport layer: TCP
32 bits
URG: Urgent data -For reliable transmission
source port # dest port #
- In Byte
sequence number
ACK: ACK #
acknowledgement number
head not
len used
UAP R S F Receive window
checksum Urg data pnter
- For flow control
RST, SYN, FIN packet Options (variable length) - In Byte

application
data
(variable length)

17
18

TCP mux/demux

application
application P4 P5 P6 application
P1 P2 P3
transport
transport transport
network
network link network
link physical link
physical server: IP physical
address B

client: IP source IP,port: B,6000 client: IP


address A dest IP,port: A,9157 source IP,port: C,5775 address C
dest IP,port: B,6001
source IP,port: A,9157
dest IP, port: B,6000
source IP,port: C,9157
dest IP,port: B,6002

One process communicates with another process by using a channel (connection) TCP
19

TCP mux/demux
multi-thread
application
application application
P4
P1 P2 P3
transport
transport transport
network
network link network
link physical link
physical server: IP physical
address B

client: IP source IP,port: B,80 client: IP


address A dest IP,port: A,9157 source IP,port: C,5775 address C
dest IP,port: B,80
source IP,port: A,9157
dest IP, port: B,80
source IP,port: C,9157
dest IP,port: B,80
20

Life cycle of TCP connection


Server application
Creates a listen socket
CLOSED
Wait Receive ACK
CLOSED
Send nothing
Send SYN

TIME_WAIT SYN_SENT LAST_ACK LISTEN

Receive FIN Receive SYN/ACK Receive SYN


Send ACK Send ACK Send FIN Send SYN/ACK

FIN_WAIT_2 ESTABLISHED CLOSE_WAIT SYN_RCVD

Send FIN
Receive ACK
Send nothing Receive FIN Receive ACK
FIN_WAIT_1 Send ACK ESTABLISHED Send nothing

Client application
Initiates close connection
21

Network application models


• Client/Server
• Peer-to-peer
• Hybrid
22

Client server model


• Client
client • Request services from
Server
• Clients do not contact
client
directly each other
• Server
• “Always” online waitng for
client requests from Clients
Server
• Ex: Web, Mail, …

client
Client/sever model
• Client asks (request) – server provides (response)
• Typically: single server - multiple clients
• The server does not need to know anything about the
client
• even that it exists
• The client should always know something about the
server
• at least where it is located: IP address, transport port
1. Client sends request
Client Server
process process Resource
4. Client 3. Server sends response 2. Server
handles handles
response request

Note: clients and servers are processes running on hosts


(can be the same or different hosts).
24

Pure Peer to Peer


Peer Peer
• No central server
• Peers have equal role
• Peers can communicate
directly to each other
Peer
Peer • Peers do not need to be
always online
• E.g. Gnutella, Emule

Peer Peer
25

Hybrid model

Client
• Central server manages
user accounts,
authentification, stores
data for searching process

Server • Clients communicate
directly after
authentication process.
• E.g. Skype
• Server manages login
Client process.
Client
• Messages, voices are
transmitted directly between
P2P Comm. servers.
Client-Server Comm.
Sockets as means for inter-process
communication (IPC)

application layer application layer

Client Process Internet Server Process


Socket Socket
transport layer (TCP/UDP) transport layer (TCP/UDP)
OS network OS network
network layer (IP)
Internet network layer (IP)
stack stack
link layer (e.g. ethernet) link layer (e.g. ethernet)
physical layer
Internet physical layer

• Socket is the interface that the OS provides for applications to access to OS networking subsystem
(transport layer and lower layer functionalities).
• Applications communicate to each other through network by interacting with their local sockets.
• Programmers need to “wire” the sockets to each other for making connection between applications.
Sockets as means for inter-process
communication (IPC)
• Address of a machine on the network
• By IP address
• Address of a process/application on a machine
• By the “port”-number
• The pair of IP-address + port – makes up a “socket-address” =>
address of an application on the Internet
Client socket address Server socket address
128.2.194.242:3479 208.216.181.15:80

Server
Client
Connection socket pair (port 80)
(128.2.194.242:3479, 208.216.181.15:80)

Client host address Server host address


128.2.194.242 208.216.181.15

Note: 3479 is an Note: 80 is a well-known port


ephemeral port allocated associated with Web servers
by the kernel
Sockets as means for inter-process
communication (IPC)
• Need to open two sockets of both sides
• Client socket
• Server socket

• Client application sends/receives data to server through


the client socket
• Server application sends/receives data to client through
the server socket
• What remains to do make two sockets talking to each
other.

You might also like