__1_Chap I -- Intro to Networking
-
Upload
hassan-el-khoury -
Category
Documents
-
view
228 -
download
0
Transcript of __1_Chap I -- Intro to Networking
8/3/2019 __1_Chap I -- Intro to Networking
http://slidepdf.com/reader/full/1chap-i-intro-to-networking 1/33
10/15/2010
1
Network programming:Network programming:Chap 1: Introduction to networking Chap 1: Introduction to networking
Dr. Mohamad Chaitou – LIU
Mohamad Chaitou2
Course contentsCourse contents
Basic Concepts, Protocols and Terminology (1 week)
Client/server scheme, TCP connection, UDP connectionless, Port,
Socket
Manipulating Internet Addresses (1 week)
DNS System, Local/Remote IP Finder Application
TCP/UDP Sockets (3 weeks)
Echo, Ping, Simplex Chat, Port Scanner, IP Scanner
Network Programming with GUIs (2.5 weeks)
Chat through GUI, Browsing Web Pages
Multithreading (1.5 weeks)
Chat with Multiple Clients, Full Duplex Chat
8/3/2019 __1_Chap I -- Intro to Networking
http://slidepdf.com/reader/full/1chap-i-intro-to-networking 2/33
10/15/2010
2
Mohamad Chaitou
Course contentsCourse contents
File Handling, Serialisation (2 weeks)
File transfer
Remote Method Invocation (2 weeks)
Banking Application
Projects’ Demos (1 week)
3
Mohamad Chaitou
AssessmentAssessment
Assignments & Participations: Weekly assignments due every
Wednesday at the beginning of class time. (10 percent)
Tests & Final Examination: Each test takes place according to the
following table:
4
Test Number Date Duration Weight
Assg & Part 10%
MID I December 1st, 2010 90 minutes 25%
Project JAN 14th, 2011 25%
Final Exam* TBA 3 hours 40%
8/3/2019 __1_Chap I -- Intro to Networking
http://slidepdf.com/reader/full/1chap-i-intro-to-networking 3/33
10/15/2010
3
Mohamad Chaitou
Network definition and advantagesNetwork definition and advantages
Definition:
A network is a set of nodes interconnected together via physical links
in order to exchange information and share resources. These nodes can
be a computer, a phone, or other network equipment such as a router
or firewall.
Advantages:
Resource sharing, e.g. Printers, memory space ( file server ), processor
( Application server or distributed application). Data exchange and communication: Networks provide new ways of
communication and of data exchange, for example, teleconference, e-mail services…etc.
5
Mohamad Chaitou
Network classificationNetwork classification
By size:
PAN, LAN, MAN, WAN
By topology:
Mesh, bus, ring, star,etc.
By performance:
Bandwidth and delay
By the type of terminals:
Telephony network
Computer network
Home network6
8/3/2019 __1_Chap I -- Intro to Networking
http://slidepdf.com/reader/full/1chap-i-intro-to-networking 4/33
10/15/2010
4
Mohamad Chaitou
Classification by size: PAN, LAN, MAN, WANClassification by size: PAN, LAN, MAN, WAN
7
1 m 10 m 100 m 1 Km 10 Km 100 Km
LAN
Local area networks
WAN
Wide area networkMAN
Metropolitan
area networks
PAN
1m: connection between a (mouse,
keyboard,printer, etc.) and
a computer)
10m/1km: building,
campus, etc: Use of Ethernet LAN or Wireless
LAN
10km: city, town Use of simple
architecture (ring): xDSL
Fiber To The Home
>100km: Internet (network inter-
connexion),Planet:
Fiber optic,satellite
Mohamad Chaitou
By topologyBy topology
Mesh:
Full:
each node is connected to all other nodes
Rarely used because it need n(n-1)/2 cables!
Partial mesh:
Each node is connected to a few number of nodes
Use of routing/switching protocols to go from node to node
BUS or Ring:
Each node is connected to a shared bus or ring
Used in Ethernet LAN
Star:
All nodes are connected to a central node
8
8/3/2019 __1_Chap I -- Intro to Networking
http://slidepdf.com/reader/full/1chap-i-intro-to-networking 5/33
10/15/2010
5
Mohamad Chaitou
By performanceBy performance
9
Mohamad Chaitou
Public switched telephony network (PSTN)Public switched telephony network (PSTN)
Used for voice transmission:
Data can be transmitted by
using a numeric to analog
modem (56kbit/s)
Data and voice cannot betransmitted simultaneously
Resources are reserved for a
call:
64 Kbit/s per channel
Multiplexing is performed
by the telephony switches
10
8/3/2019 __1_Chap I -- Intro to Networking
http://slidepdf.com/reader/full/1chap-i-intro-to-networking 6/33
10/15/2010
6
Mohamad Chaitou
Computer network Computer network
A set of computer connected
between them by the same
technology
Many computer network can
be connected between them:
This is the example of the
internet
11
Mohamad Chaitou
Wireless networksWireless networks
Multiple technologies:
GSM, 3G, 3G+, 4G
Wireless LAN (standard IEEE 802.11): up to 54 Mbit/s for several meters
Example: WIFI, ADHOC, BLUETOOTH
12
8/3/2019 __1_Chap I -- Intro to Networking
http://slidepdf.com/reader/full/1chap-i-intro-to-networking 7/33
10/15/2010
7
Mohamad Chaitou
StandarizationStandarization
IETF (Internet Engineering Task Force):
Regroups: constructors, network operators and researchers from all the
world
It aims to produce standards called RFC (Request For Comments) for
protocols covered by the technology TCP/IP. It aims also to ensure a
long-term development of the Internet
IEEE(Institute of Electrical and Electronics EngineersInstitute of Electrical and Electronics Engineers):
IEEE has started the standardization of local networks in 1979.
This process consists of applying the principles of layers 1 and 2 of the
OSI model on the varieties of LAN and MAN networks This working group has taken the name of IEEE 802.X in 1980
13
Mohamad Chaitou
OSI model (1)OSI model (1)
Open System Interconnexion:
based on a principle stated by Julius Caesar 'divide and rule‘
description of networks as a set of layers superimposed on each other:
their number, their name, their function varies depending on the network
the goal of each layer is to provide services to higher layers:
– the latter do not know the implementation of these services
The study of the network is reduced to that of its parts, the whole
becomes easier to manipulate
14
8/3/2019 __1_Chap I -- Intro to Networking
http://slidepdf.com/reader/full/1chap-i-intro-to-networking 8/33
10/15/2010
8
Mohamad Chaitou
OSI model (2)OSI model (2)
7 functional layers divided into 2 groups:
lower layers:
transport functions
information transfer between terminals via a telecommunication network
layers 1-4
upper layers:
application management
applications taken over by the terminal
layers 5-7
15
Mohamad Chaitou
OSI model (3)OSI model (3)
Layer 1 - Physical: transmission of bits on physical support. Also, it
determines the voltage of each bit level, length of bits, modulation, etc.
Layer 2 - Link: transfer of information in the form of frames, detection and
correction of errors.
Layer 3 - Network: establishment and release of communications, routing
through the network: Internet protocol (IP)
Layer 4 - Transport: transports information reliably from one end of theconnection to the other end, connection procedure: TCP or UDP
Layer 5 - Session: organization of the exchange and structure of dialogue
between applications (example: negociate if half-duplex or full duplex)
Layer 6 - Presentation: syntax for the exchange of information (alphabet,
presentation graphics, etc..). Representing data independently from usedplatforms or OS. The security mechanism to access information
Layer 7 - Application: contains the mechanism that can be activated for
different services (applications). The user accesses OSI by this service. The
applications are not parts of this layer: HTTP, FTP, SMTP, etc.16
8/3/2019 __1_Chap I -- Intro to Networking
http://slidepdf.com/reader/full/1chap-i-intro-to-networking 9/33
8/3/2019 __1_Chap I -- Intro to Networking
http://slidepdf.com/reader/full/1chap-i-intro-to-networking 10/33
8/3/2019 __1_Chap I -- Intro to Networking
http://slidepdf.com/reader/full/1chap-i-intro-to-networking 11/33
10/15/2010
11
Mohamad Chaitou
OSI Model (8)OSI Model (8)
There are three key concepts for the OSI model:
SAP (SERVICE ACCESS POINT):
identifies the interfaces between adjacent layers in the equipment. The
interface between Layer 1 (Physical) and layer 2 is named PH-SAP, between
layer 2 and 3 is DL-SAP, between layer 3 and 4 N-SAP, etc.
Primitives:
constitute the basis of dialogue between the adjacent layers in the
equipment. There are 4 types: request, indication, response and
confirmation. They are used by the layer n requesting a service from layern-1 and offering the service to layer n +1.
Protocols rules defining the dialogue between the layers of the same level for two
terminals in communication. The precise specification of protocols impliesthat there is a detailed division of functions between the terminals.
21
Mohamad Chaitou
Introduction to InternetIntroduction to Internet
A little history on the Internet:
Research from the DARPA
Defense Advanced Research Projects Agency
ARPANET network
– first network packet (beginning 1970)
– point to point links (terrestrial, radio, satellite) 1980: TCP / IP implemented on the DARPA network
this is the beginning of the Internet!
DARPA will require that all machines of ARPANET have to use TCP / IP
TCP / IP is then integrated into the UNIX world
Entering into the academic world
22
8/3/2019 __1_Chap I -- Intro to Networking
http://slidepdf.com/reader/full/1chap-i-intro-to-networking 12/33
10/15/2010
12
Mohamad Chaitou
Introduction to InternetIntroduction to Internet
What is the Internet?
virtual network constructed by interconnecting physical networks
through gateways: Routers
need for a universal communication service
TCP / IP allows the use of applications without knowing the technology andarchitecture of the Internet
23
Network 1 network 2 Network 3 3
Mohamad Chaitou
Introduction to InternetIntroduction to Internet
24
InternetInternet
Users view of the Internet
8/3/2019 __1_Chap I -- Intro to Networking
http://slidepdf.com/reader/full/1chap-i-intro-to-networking 13/33
10/15/2010
13
Mohamad Chaitou
Introduction to InternetIntroduction to Internet
Reality of the Internet
25
Mohamad Chaitou
The IP layerThe IP layer
IP: Internet Protocol (RFC 791)
comparable to the layer 3 of OSI model (Network)
IP is operating over everything it is the convergence protocol
It works on all existing level 2 protocols:
Ethernet (RFC 894)
Token-Ring (RFC 1469)
Serial connexion: SLIP (RFC 1055), PPP (RFC 1353), X25 (RFC 877), FR (RFC
1294)
FDDI (RFC 1188)
ATM (RFC 1483, RFC 1577, LANE)
26
8/3/2019 __1_Chap I -- Intro to Networking
http://slidepdf.com/reader/full/1chap-i-intro-to-networking 14/33
10/15/2010
14
Mohamad Chaitou
The IP layerThe IP layer
The TCP/IP model and the OSI model
27
Mohamad Chaitou
The IP datagramThe IP datagram
The format of the IP datagram
28
Options (+ padding)Options (+ padding)
VersionVersion IHLIHL TypeType--ofof--serviceservice Total lengthTotal length
Fragement OffsetFragement OffsetIdentificationIdentification FlagsFlags
TimeTime--toto--livelive ProtocolProtocol Header checksumHeader checksum
Source addressSource address
Destination addressDestination address
Data (variable)Data (variable)
1717 3232191911 44 55 88 99 1616 2020
IP headerIP header DataData
Minimum 20Minimum 20 bytesbytes
8/3/2019 __1_Chap I -- Intro to Networking
http://slidepdf.com/reader/full/1chap-i-intro-to-networking 15/33
10/15/2010
15
Mohamad Chaitou
The IP datagram:The IP datagram: demultiplexingdemultiplexing by using theby using the“protocol” field of the header“protocol” field of the header
29
IP ModuleIP Module
DatagramDatagram arrivalarrival
ICMPICMP UDPUDPTCPTCP
Mohamad Chaitou
The IP datagramThe IP datagram
Source @ field (32 bits): @ IP of the transmitter
Destination @ field (32 bits): @ IP of the destination
These are the addresses of the end machines and not those of
intermediate equipments!
Options field (variable size): Allows extensions
option code (1 byte) + length of option (1 byte) + data associated
Padding field (variable size)
Complete the Options field so that the length of the header is a
multiple of 32 bits
Note: size of the IP header ≥≥≥≥ 20 bytes
30
8/3/2019 __1_Chap I -- Intro to Networking
http://slidepdf.com/reader/full/1chap-i-intro-to-networking 16/33
10/15/2010
16
Mohamad Chaitou
ICMPICMP
Internet Control Message Protocol (RFC 792)
Protocol of 'management' of the network
error reporting mechanisms
Implemented on all IP devices
ICMP is contained in the IP datagram
Protocol field = 1
Sent by the destination device or an intermediate router:
if there is a problem with the IP datagram
to notify the transmitter to change its behavior
31
Mohamad Chaitou
ICMPICMP
Using ICMP: PING (Packet INternet Groper)
To verify IP connectivity equipment with other network equipment
By default: sending 4 queries and waiting for 4 answers
Example:
32
8/3/2019 __1_Chap I -- Intro to Networking
http://slidepdf.com/reader/full/1chap-i-intro-to-networking 17/33
10/15/2010
17
Mohamad Chaitou
IP addressing, DNSIP addressing, DNS
The IP addresses:
consists of 4 bytes (32 bits)
notation "dotted decimal" : X.X.X.X with 0 <= X <= 255
Example: 130.190.57.12
2 distinct parts:
network address: network ID
assigned by an authority, identifies the network
machine address: host ID
assigned by the administrator, identifies the machine (host)
It must be unique (@ public)
Software configurable
associated with each network interface
33
Mohamad Chaitou
IP addresses and DNSIP addresses and DNS
Normally, human beings will use domain names in preference to IP
addresses, but they can just as well use the corresponding IP
addresses (if they know what they are!). The Domain Name System
provides a mapping between IP addresses and domain names and is
held in a distributed database. The IP address system and the DNS
are governed by ICANN (the Internet Corporation for Assigned
Names and Numbers), which is a non-profitmaking organisation.When a URL is submitted to a browser, the DNS automatically
converts the domain name part into its numeric IP equivalent.
34
8/3/2019 __1_Chap I -- Intro to Networking
http://slidepdf.com/reader/full/1chap-i-intro-to-networking 18/33
10/15/2010
18
Mohamad Chaitou
IP addressingIP addressing
35
TNA - 28/08/02
35
. . .10101010 01010101 00110011 11001100
170 85 51 204
Binary notation
Decimal notation
32 bits
Network id Host id
8 bits 8 bits 8 bits 8 bits
. . .
.
.
. .
.
. ...
Classe A16 777 214 machines
Classe B65 534 machines
Classe C254 machines
1 to 126 host host host
128 to 191 0 to 255 host host
192 to 223 0 to 255 0 to 255 host
Mohamad Chaitou
IP addressingIP addressing
The concept of sub-networks (subnetting)
pure classes -> limited flexibility, waste places
Cutting the network into smaller entities:
decided by the network administrator
36
@ hôte@ network
@initial host id
@ host@ subnet
@final net id @final host id
@initial network id
This division may be unknown to the outside
All network devices must use the notion of sub-networks (PC,routers, printers, ...)
Interconnection of subnets by routers
8/3/2019 __1_Chap I -- Intro to Networking
http://slidepdf.com/reader/full/1chap-i-intro-to-networking 19/33
10/15/2010
19
Mohamad Chaitou
IP addressingIP addressing
The division is made possible by using a subnet mask :
same notation as the IP address (32 bits): X.X.X.X
X values: 0, 128, 192, 224, 240, 248, 252, 255
bit 1 -> designate the network portion
bit 0 -> means the party host
CIDR: Classless Routing InterDomain
address format: @ IP / x, where x is the number of bits in the network
address (the rest designating the host part)
ex: Class B: 130.190.0.0
default mask: 255.255.0.0 -> 130.190.0.0/16
255.255.255.0 mask if dividing into 256 subnets of class C ->
130.190.0.0/24
37
Mohamad Chaitou
IP addressingIP addressing
Subnetting IP Address (1st method)
IP: 170.85.51.204
Subnet Mask: 255.255.248.0 or / 21
38
.
.
.
.
.
.
@ IP
Mask11111111 11111111 11111 000 00000000
10101010 01010101 00110011 11001100
170 85 51 204
255 255 248 0
. . . @ network10101010 01010101 00110 000 00000000
170 85 48 0
. . . @ host00000000 00000000 00000 011 11001100
0 0 3 204
2 046 possible host
8/3/2019 __1_Chap I -- Intro to Networking
http://slidepdf.com/reader/full/1chap-i-intro-to-networking 20/33
10/15/2010
20
Mohamad Chaitou
IP addressingIP addressing
Subnetting (2nd method): “complement to 255“
IP address: 170.85.51.204
Subnet Mask: 255.255.248.0 or / 21
what is the @ Network and the @ of the host?
(255 - 248) + 1 = 8 (the value used for sub-network partitioning)
subnet 1 : 170.85.0.x to 170.85.7.x
subnet 2 : 170.85.8.x to 170.85.15.x
subnet 3 : 170.85.16.x to 170.85.23.x
subnet 4 : 170.85.24.x to170.85.31.x
subnet 5 : 170.85.32.x to 170.85.39.x
subnet 6 : 170.85.40.x to 170.85.47.x
subnet 7 : 170.85.48.x to 170.85.55.x
etc … until 170.85.255.x 39
@ network:@ network:
170.85.48.0170.85.48.0
@ host(51@ host(51--48 = 3) :48 = 3) :0.0.3.2040.0.3.204
Mohamad Chaitou
The transport layerThe transport layer
Two protocols are used for communication between applications:
UDP: User Datagram Protocol
Connectionless
the sending machine sends data without notifying the receiving machine,
and the receiving machine receives the data without sending a receipt tothe sending machine
TCP: Transmission Control Protocol
Connection-oriented
the receiving machine sends acknowledgments during the communication
and the sending machine guarantees the validity of the data it sends
40
8/3/2019 __1_Chap I -- Intro to Networking
http://slidepdf.com/reader/full/1chap-i-intro-to-networking 21/33
10/15/2010
21
Mohamad Chaitou
The transport layerThe transport layer
Need for identifying an application:
the identification is made by a port number
abstract value used only by the transport protocol to designate an
application
Combination (IP address - port number):
necessary to identify the processes on a machine : it is called "demon“
ex: 130.190.5.1 - port 23 is the telnet demon on the station 130.190.5.1
The combination of two (IP address - port number) completely
defines a TCP or UDP flow:
ex: 130.190.5.1 - 23 and 147.171.150.2 – 1094
User 147.171.150.2 took a telnet in 130.190.5.1
41
Mohamad Chaitou
The transport layerThe transport layer
Pre-defined Ports (RFC 1060 "Assigned Numbers") for standard
services:
Ports are coded on 16 bits: 65536 possibilities
Ports 0-1023: Well Known Ports
assigned by the IANA: only to be used by system processes or programs
executed by privileged users
ports 1024-49151: registered ports (Registered)
Ports 49152 to 65535: dynamic or private ports
All equipment TCP / IP must respect this allocation
42
port 21port 21 --> FTP> FTP port 23port 23 --> Telnet> Telnetport 25port 25 --> SMTP> SMTP port 69port 69 --> TFTP> TFTPport 53port 53 --> DNS (Domain Name Server)> DNS (Domain Name Server) port 80port 80 --> HTTP> HTTP
8/3/2019 __1_Chap I -- Intro to Networking
http://slidepdf.com/reader/full/1chap-i-intro-to-networking 22/33
10/15/2010
22
Mohamad Chaitou
UDPUDP
User Datagram Protocol
connectionless service, no warranty, using IP to transport messages
between machines
UDP segment is contained in an IP datagram
43
Source PortSource Port Destination PortDestination Port
ChecksumChecksumLengthLength
1717 323211 1616
IP headerIP header DataData
8 octets8 octets
UDP headerUDP header
IP dataIP data
Mohamad Chaitou
UDPUDP
Compared to IP, UDP adds information indicating the service used:
44
UDPUDP multiplexingmultiplexing
IP layerIP layer
Port 161Port 161 Port 69Port 69Port 123Port 123
DatagramDatagram UDPUDP
ntpntpsnmpsnmp tftptftp
8/3/2019 __1_Chap I -- Intro to Networking
http://slidepdf.com/reader/full/1chap-i-intro-to-networking 23/33
10/15/2010
23
Mohamad Chaitou
UDPUDP
UDP does not:
connected mode
packet retransmission if errors or losses
sequencing of packets
Flow Control -> very easy to saturate a LAN or router! (Streaming
audio / video)
It is an unreliable transport protocol:
used by NFS (Network File System)
used for broadcasting:
TFTP (Trivial File Transfer Protocol)
NTP (Network Time Protocol)
more generally: when the multicast is required
45
Mohamad Chaitou
TCP protocolTCP protocol
Transmission Control Protocol
The TCP / IP is enabled on all network devices with
IP (routers, workstations, ...)
The aim is to transport data:
end to end between applications
connected mode: establishement/closure of sessions
without error: control and retransmission if necessary
Lossless: "dial" and retransmission
ordered: sequencing of packets
Acknowledgment system
flow control: emission window
Full Duplex..
46
8/3/2019 __1_Chap I -- Intro to Networking
http://slidepdf.com/reader/full/1chap-i-intro-to-networking 24/33
10/15/2010
24
Mohamad Chaitou
TCP/IP architectureTCP/IP architecture
47
Mohamad Chaitou
Ports and socketsPorts and sockets A port is a logical connection to a computer (as opposed to a
physical connection) and is identified by a number in the range 1-
65535. This number has no correspondence with the number of
physical connections to the computer, of which there may be only
one
Addresses would be all you needed if each computer did no more
than one thing at a time. However, modern computers do many
different things at once. Email needs to be separated from FTPrequests, which need to be separated from web traffic. This is
accomplished through ports.
In most applications, of course, there are likely to be multiple
clients wanting the same service at the same time. A common
example of this requirement is that of multiple browsers (quite
possibly thousands of them) wanting Web pages from the same
server. The server, of course, needs some way of distinguishing
between clients and keeping their dialogues separate from each
other. This is achieved via the use of sockets.48
8/3/2019 __1_Chap I -- Intro to Networking
http://slidepdf.com/reader/full/1chap-i-intro-to-networking 25/33
10/15/2010
25
Mohamad Chaitou
Ports and socketsPorts and sockets
When a client wishes to make connection to a server, it will create
a socket at its end of the communication link. Upon receiving the
client's initial request (on a particular port number), the server will
create a new socket at its end that will be dedicated to
communication with that particular client. Just as one hardware
link to a server may be associated with many ports, so too may one
port be associated with many sockets
49
Mohamad Chaitou
Ports and socketsPorts and sockets
50
8/3/2019 __1_Chap I -- Intro to Networking
http://slidepdf.com/reader/full/1chap-i-intro-to-networking 26/33
10/15/2010
26
Mohamad Chaitou
TCPTCP
TCP treats the data from the upper layers as a sequence of bytes
It Cuts this sequence of bytes in TCP segments
maximum size: 64 Kbytes
size depends on the media in face of the sending station
Segments are exchanged to:
open connections
transfer data manage flow control: sends "ACK“
inform the window size
close connections
51
Mohamad Chaitou
TCPTCP
Connected mode: mechanism "Send and Wait“
It transmits a packet, then waits for acknowledgment before sending
the following one:
52
TransmitTransmit packetpacket 11
ReceiveReceive packetpacket 11
Transmit ACK 1Transmit ACK 1
ReceiveReceiveACK 1ACK 1
ReceiveReceive PacketPacket 22
TransmitACKTransmitACK 22
TransmitTransmit PacketPacket 22
ReceiveReceiveACK 2ACK 2
SenderSender receiverreceivernetworknetwork
8/3/2019 __1_Chap I -- Intro to Networking
http://slidepdf.com/reader/full/1chap-i-intro-to-networking 27/33
10/15/2010
27
Mohamad Chaitou
TCPTCP
If there is no acknowledgment (ACK) at the expiration of the timer,
it retransmits the packet and then waits again, etc.
This technique uses very little network
The network is only used when transmitting
eg transmission time tt =, tp = propagation time , efficiency = tt / (tt + 2 x
tp) = 1 / (1 + 2 x tp / tt)
if the network size increases (ie tp increases), efficiency decreases!
Introduction of the window of anticipation (or transmissionwindow) to maximize the effeciency of TCP exchanges
53
Mohamad Chaitou
TCPTCP
Mechanism of the "sliding window”
The transmitter may send 3 packets before receiving an
acknowledgment
The ack of a packet arrives, the window slides:
The performance depends on the size of the window and the speed
at which the network accepts packets
54
Initial windowInitial window
11 22 33 44 55 66 77 88PacketsPackets
SlidingSliding
11 22 33 44 55 66 77 88PacketsPackets
8/3/2019 __1_Chap I -- Intro to Networking
http://slidepdf.com/reader/full/1chap-i-intro-to-networking 28/33
10/15/2010
28
Mohamad Chaitou
TCPTCP
If the window is large enough, there is no blockage
55
SenderSender destinationdestinationnetworknetwork
Important :Important :•• no blocking because ACK1 received before the end ofthe transmission window
endend rxrx segment 1segment 1-->> txtx ACK 1ACK 1
endend rxrx segment 2segment 2
-->> txtx ACK 2ACK 2
endend rxrx segment 3segment 3-->> txtx ACK 3ACK 3
TransmissionTransmission
windowwindow
tttt
tttt
tttt
tptp
endend rxrx segment 4segment 4
-->> txtx ACK 4ACK 4
endend rxrx segment 5segment 5-->> txtx ACK 5ACK 5
Mohamad Chaitou
TCPTCP
If he window size is too small, then there is blocking:
56
BlockingBlocking zonezone
BlockingBlocking zonezone
SenderSender ReceiverReceiverNetworkNetwork
TransmissionTransmissionwindowwindow
tttt
tttt
tttt
endend rxrx segment 1segment 1-->> txtx ACK 1ACK 1
endend rxrx segment 2segment 2-->> txtx ACK 2ACK 2
endend rxrx segment 3segment 3-->> txtx ACK 3ACK 3
endend rxrx segment 4segment 4
-->> txtx ACK 4ACK 4
EndEnd rxrx segment 5segment 5
-->> txtx ACK 5ACK 5
endend rxrx segment 6segment 6-->> txtx ACK 6ACK 6
tptp
TransmissionTransmissionwindowwindow
tttt
tttt
tttt
8/3/2019 __1_Chap I -- Intro to Networking
http://slidepdf.com/reader/full/1chap-i-intro-to-networking 29/33
10/15/2010
29
Mohamad Chaitou
TCPTCP
Flow Control:
the recipient plays with the space available in its buffers to reduce (or
increase) the transmission window:
WINDOW field in the TCP frame
number of bytes that the receiver can process
– transmission window accordingly modified
Flow control is essential to the Internet
heterogeneous Internet systems
TCP solves the problem with the "Sliding Window“
Machines of the Internet are of different capacities:
TCP solves the problem by the algorithm of "Slow Start“
segment loss interpreted as a sign of congestion
transmission window is reduced sharply
57
Mohamad Chaitou
TCPTCP
A TCP segment is contained in an IP datagram
protocol field of IP datagram = 6
58
IP HeaderIP Header DataData
min 20min 20 bytesbytes
TCP headerTCP header
IP dataIP data
WindowWindowReservedReserved
Options (+ padding)Options (+ padding)
Source PortSource Port Destination PortDestination Port
Sequence NumberSequence Number
Acknowledgment NumberAcknowledgment Number
Data OffsetData Offset
ChecksumChecksum
Data (variable)Data (variable)
1717 323211 1616
SSYYNN
FFIINN
AACCKK
UURRGG
PPSSHH
PPSSTT
Urgent PointerUrgent Pointer
44 55 12121313141415151010 1111
8/3/2019 __1_Chap I -- Intro to Networking
http://slidepdf.com/reader/full/1chap-i-intro-to-networking 30/33
10/15/2010
30
Mohamad Chaitou
FirewallsFirewalls
The most basic firewall is a packet filter that inspects each packet
coming into or out of a network and uses a set of rules to
determine whether that traffic is allowed.
Filtering is usually based on network addresses and ports. For
example, all traffic coming from the Class C network 193.28.25
may be rejected because you had bad experiences with hackers
from that net in the past.
Outgoing Telnet connections may be allowed, but incoming Telnet
connections may not be. Incoming connections on port 80 (Web)
may be allowed but only to the corporate web server.
The exact configuration of a firewall—which packets of data are
and are not allowed to pass through—depends on the security needs
of an individual site.
59
Mohamad Chaitou
FirewallsFirewalls
60
8/3/2019 __1_Chap I -- Intro to Networking
http://slidepdf.com/reader/full/1chap-i-intro-to-networking 31/33
10/15/2010
31
Mohamad Chaitou
Proxy serversProxy servers
A machine that is prevented from connecting to the external
network by a firewall would make a request for a web page from
the local proxy server instead of requesting the web page directly
from the remote web server.
The proxy server would then request the page from the web server
and forward the response to the original requester.
While firewalls generally operate at the level of the transport or
internet layer, proxy servers operate at the application layer. A
proxy server has detailed understanding of some application level
protocols, like HTTP and FTP.
Packets that pass through the proxy server can be examined to
ensure that they contain data appropriate for their type. For
instance, FTP packets that seem to contain Telnet data can be
rejected.
61
Mohamad Chaitou
Proxy serversProxy servers
Proxy servers can also be used to implement local caching. When a
file is requested from a web server, the proxy server will first
check to see whether the file is in its cache. If the file is in the
cache, then the proxy will serve the file from the cache rather than
from the Internet. If the file is not in the cache, then the proxy
server will retrieve the file, forward it to the requester, and store
it in the cache for the next time it is requested.
62
8/3/2019 __1_Chap I -- Intro to Networking
http://slidepdf.com/reader/full/1chap-i-intro-to-networking 32/33
10/15/2010
32
Mohamad Chaitou
Client/Server modelClient/Server model
A client/server application typically stores large quantities of data
on an expensive, high-powered server, while most of the program
logic and the user interface is handled by client software running
on relatively cheap personal computers.
63
Mohamad Chaitou
Client/server modelClient/server model
Some servers process and analyze the data before sending the
results to the client. Such servers are often referred to as
"application servers" to distinguish them from the more common
file servers and database servers. A file or database server will
retrieve information and send it to a client, but it won't process
that information.
Web servers such as Apache respond to requests from web clients
such as Netscape.
An older service that fits the client/server model is FTP.
Java is a powerful environment in which to write GUI programs that
access many different kinds of servers
Java makes it easy to write clients of all sorts, but it really shines
when you start writing servers.
64
8/3/2019 __1_Chap I -- Intro to Networking
http://slidepdf.com/reader/full/1chap-i-intro-to-networking 33/33
10/15/2010
Mohamad Chaitou
Client/server modelClient/server model
Not all applications fit easily into a client/server model. For
instance, in networked games it seems likely that both players will
send data back and forth roughly equally (at least in a fair game).
These sorts of connections are called "peer-to-peer". The telephone
system is the classic example of a peer-to-peer network.
Java does not have explicit peer-to-peer communication in its
networking API. However, applications can easily implement peer-
to-peer communications in several ways, most commonly by acting
as both a server and a client. Alternatively, the peers can
communicate with each other through an intermediate server
program that forwards data from one peer to the other peers.
65