Chapter 1
Chapter 1
2
Content
• Computer Networks
• OSI and TCP/IP models
• Internet Protocol (IP)
• Transport layer, TCP, UDP
• Network application models
• Socket concept
3
Computer Networks
• Inter-connection of nodes mobile network
by transport medium
following some architecture: global ISP
institutional
network
4
OSI and TCP/IP models
5
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, recovery of
data transmission process
• Transport layer: Transmits data between applications
• Network layer: Transmits data between distance network
elements: Taking care of routing and forwarding data
• Data link layer: Transmits data between adjacent network
elements.
• Physical layer: Transmits bits on the medium. Converting
bits to physical form appropriate to the medium.
6
OSI and TCP/IP models
• OSI model: reference model
• TCP model: Internet model
• Transport layer: TCP/UDP
• Network layer: IP + routing protocols.
7
Internet protocols mapping on TCP/IP
PING
8
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
• Socket is the API to access transport layer functions
9
Internet Protocol (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
10
IP Packet
11
Transport Layer
12
Transport Layer
• How data from different
applications between two hosts
can be delivered to right
application?
• Each application process is
assigned a transport port (16 bits)
• Application sends data to the
transport layer through the port.
• Socket:
• Application access point for
application
• It is a combination of (Address IP,
transport port)
13
Transport Layer - UDP
• MUX/DeMUX
• Best effort
• Connectionless
• Send independent
datagrams
• Drop error datagrams
• No congestion control
14
Transport Layer - TCP
• Connection oriented protocol
• 3-step connection opening
• Reliable protocol
• Re-transmission on error
• Flow control
• Congestion control
15
Transport Layer - UDP
• Each process uses a port to communicate with other
process
• One process can communicate with several others using
UDP
16
Transport Layer - TCP
17
Transport Layer - TCP
18
Life cycle of TCP connection
19
Network application models
• Client/Server
• Peer-to-peer
• Hybrid
20
Network application models
21
Network application models
• Client asks (request) – server provides (response)
• Typically: single server - multiple clients
• The server does not need to know anything about the client
• The client should always know something about the server
• Where it is located (IP Address, Domain Name)
• Service port to connect (80, 443, 20, 21, etc.)
22
Network application models
• No central server
• Peers have equal role
• Peers can communicate
directly to each other
• Peers do not need to be
always online
• E.g. Gnutella, Emule
23
Network application models
• Central server manages user
accounts, authentification,
stores data for searching
process …
• Clients communicate directly
after authentication process
• E.g., Skype
• Server manages login process.
• Messages, voices are
transmitted directly between
servers.
24
Socket
• Sockets as means for inter-process communication
(IPC)
• The interface that the OS provides to its networking
subsystem
25
Socket - Connection
26
Socket - Connection
• Need to open two sockets of both sides
• Client socket
• Server socket
• Client application send/receive data to server
through client socket
• Server application send/receive data to client
through client socket
• Make two sockets talking to each other
27
Q&A
28