02-Related Concept in Computer Networks (1)
02-Related Concept in Computer Networks (1)
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
...
ICMP RIP OSPF
Network IP
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
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
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
Send FIN
Receive ACK
Send nothing Receive FIN Receive ACK
FIN_WAIT_1 Send ACK ESTABLISHED Send nothing
Client application
Initiates close connection
21
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
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)
• 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)