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

Chapter 1

The document provides an overview of network programming, covering key concepts such as computer networks, OSI and TCP/IP models, Internet Protocol (IP), transport layers (TCP and UDP), and network application models. It explains the roles of different layers in data transmission and introduces sockets as a means for inter-process communication. Additionally, it outlines various network application models including client/server, peer-to-peer, and hybrid systems.

Uploaded by

ngominh9499
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views28 pages

Chapter 1

The document provides an overview of network programming, covering key concepts such as computer networks, OSI and TCP/IP models, Internet Protocol (IP), transport layers (TCP and UDP), and network application models. It explains the roles of different layers in data transmission and introduces sockets as a means for inter-process communication. Additionally, it outlines various network application models including client/server, peer-to-peer, and hybrid systems.

Uploaded by

ngominh9499
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 28

Network Programming

Computer Network Review


School of Information and Communication Technology,
Hanoi University of Science and Technology
References
[1] W.Richard Stevens, Unix Network Programming Vol.1, 3rd Ed., Prentice
Hall.
[2] Keir Davis, John W. Turner, and Nathan Yocom, The Definitive Guide to
Linux Network Programming, Apress.
[3] Michael Donahoo, Kenneth Calvert, TCP/IP Sockets in C: Practical Guide
for Programmers, Elsevier.

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

• Using a topology: bus, star,


ring, hybrid… home
network
• Using some communication regional ISP
protocols

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

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy