Transcript TCP/IP

CPE 426 Computer Networks
Week 1: Introduction
Review 1:
Data Communications
Course Outlines


ดูใน Sheet
สามารถ Download ได้

http://cpe.rsu.ac.th/ut
TOPICS

1. Communication/NW Model


2. Communication Protocols OSI
and TCP/IP


Ch.5.1-5.5
Ch.1.1-1.10
3. Communication/NW Topology

Ch. 13.8
TOPICS

4. Signal/Power/Loss


5. Data Coding(Line Coding)


Ch.6.1-6.10
Ch.6.11-6.20
6. Trasmission
Media/Noise/Channel Capacity

Ch.7.1-7.10 & 7.20-7.22
TOPICS

7. Multiplexing & DSL


8. Asynchronous Communication


Ch.11.1-11.3 & 12.1-12.7
Ch.9.1-9.8
9. Synchronous Communication

Ch.9.9-9.13
TOPICS

10. Flow Control/Error
Control/ARQ


11. Circuit vs Packet Switching NW


Ch. 8.12-8.15
Ch. 3.1-3.5 % 13.1-13.5
ALSO Reference From CPE 326
(Stalling Book)
ื่ สาร ประกอบด้วย 2 Entity
การสอ
Sender = Source
ผูส้ ่ ง หรื อแหล่งกำเนิดข้อมูล
Transmitter
DATA
Destination
ผูร้ ับ หรื อ ปลำยทำงข้อมูล
Receiver
Signal = สัญญำณ
Transmission Medium
DATA
Data comm.Model มี 5 สว่ น
Sender = Source
ผูส้ ่ ง หรื อแหล่งกำเนิดข้อมูล
Transmitter
DATA
ABC…
Receiver
Signal = สัญญำณ
DATA
Transmission Medium
01011…
Plus Error
01011…
File: ABCD… 
Data Coding/Compression
(ASCII, EBCDIC/ZIP)
010110001101….
Destination
ผูร้ ับ หรื อ ปลำยทำงข้อมูล
Wire/Wireless
Loss and Noise
Line Coding/Modulation
Plus Multiplexing
Decodine/Demodulation
Demultiplexing
ABC…
ADC…
ASCII Code

American Standard Code for Information Interchange

ASCII includes definitions for 128 characters: 33 are non-printing control
characters (now mostly obsolete) that affect how text and space is
processed; 94 are printable characters, and the space is considered an
invisible graphic. The most commonly used character encoding on the
World Wide Web was US-ASCII until December 2007, when it was
surpassed by UTF-8
ื่ สาร
Mode ของการสอ

Data Communication Model ที่
้ าหร ับการสอ
ื่ สารสองคน
กล่าวถึงใชส

ถ ้ามีวงจรรับและสง่ แยกจากกัน โดยใช ้
Transmission Medium คนละตัว


Simplex
ถ ้าใช ้ Transmission อันเดียวกัน


Duplex
ื่ สารสองทางได ้พร ้อมกัน
ถ ้าสอ


Full-Duplex
ื่ สารสองทางไม่พร ้อมกัน
ถ ้าสอ

Half-Duplex
Simplex
บางครงเรี
ั้ ยก 4-wire Duplex
Source
Tx
Rx
Destination
Tx
Source
Transmission Medium
Destination
Rx
Transmission Medium
Duplex
Source
Tx
Destination
Rx
Transmission Medium
Rx
Destination
Tx
Source
Half-Duplex
Destination
Source
Tx/Rx
Destination
Tx/Rx
Transmission Medium
Full-Duplex
Source
ื่ สารมากกว่า 2 คน
ถ้าเราต้องการสอ

ใชว้ งจร(Duplex)ด ังกล่าวตามจานวนคู่
ื่ สาร = Full Mesh Topology
ของการสอ
B
C
A
D
F
E
จานวนวงจร
= n(n-1)/2
=O(n2)
ราคาแพงมากถ ้า
n มีคา่ สูง
= O(n2)
ื่ มต่อของอุปกรณ์ตา่ งๆเข้าด้วยก ัน
Topology ในภาษา Network คือรูปแบบการเชอ
วิธแ
ี ก้คอ
ื Share Medium และทา
Multiple Access Control

ใน LAN จะใช ้ Topology 3 แบบทีส
่ าค ัญ

Bus (และ Tree), Ring, Star
hub
วิธแ
ี ก้คอ
ื Share Medium และทา
Multiple Access Control

ใน WAN ม ักจะเป็น Partial Mesh
Medium จัดได ้ว่าเป็ น Statistical Time
Division Multiplexing แบบหนึง่

C
A
Intermediate Node
= Switching/Routing Node
D
B
End Node
E
H
G
F
การ Share Medium




ต้องมีการควบคุม = Medium Access Control
ื่ หรือ Address
End Node จะต้องมีการกาหนดชอ
สาหร ับอ้างอิง หรือกาหนด Circuit Number
้ มายเลขอ้างอิงด ังกล่าว
Intermediate Node จะใชห
ิ ใจสง
่ ข้อมูลต่อออกไป(Forwarding)
ในการต ัดสน
ด ังนน
ั้




1. Data ทีส
่ ง่ จะต ้องแปะสว่ นหัว (Header) ด ้วยข ้อมูลต่างๆของ
Address และการ Control เราเรียกว่าเป็ นการทา Encapsulation
ผลลัพธ์ทไี่ ด ้เรียกว่า Frame
2. ทีส
่ ว่ นท ้ายของ Frame จะมีการต่อด ้วยข ้อมูลชว่ ยตรวจจับความ
ผิดพลาด (Error Detection) มักจะเป็ น CRC Code เรียก Frame
Check Sequence(FCS)
3. ก่อนหน ้าสว่ น Header และหลัง FCS อาจจะมีการเติมบิตสาหรับ
ชว่ ยตรวจจับหัวและท ้ายของ Frame (Frame Delimiter: Preamble/Post-amble)
4. สาคัญทีส
่ ด
ุ ต ้องมีการกาหนดกฎเกณฑ์ตา่ งๆเหล่านีใ้ ห ้เป็ น
ื่ สาร
มาตรฐาน คือกาหนดเป็ น Protocol ของการสอ
LAN vs WAN Technologies

้ าร Share Medium แบบ Contention
LAN ม ักจะใชก
ด ังนนจะต้
ั้
องมีขบวนการควบคุมการทา Multiple
Access


่ ก ัน แต่ม ักจะใชว้ ธ
WAN จะ Share Medium เชน
ิ ข
ี อง
Synchronous Multiplexing (TDM) ใน Circuit
Switching Networkหรือ Statistical Multiplexing
(ใชใ้ น Packet Switching Network)


Topology ทีเ่ หมาะสมคือ Bus, Ring, Star
Topology ทีเ่ หมาะสมคือ Mesh Network และมักจะเป็ น Partial
Mesh
Internetworking Technologies ม ักจะถูกใชใ้ นการ
ื่ มต่อระหว่าง LAN ผ่าน WAN Network
เชอ

ทีน
่ ย
ิ มคือ Internet (IP Network)
Protocol and Protocol
Architecture



ื่ สาร
Protocol เป็นต ัวกาหนดกฏเกณฑ์สาหร ับการสอ
ื่ สารจะทา
ถ้ากาหนดเป็นมาตรฐาน หรือ Standard การสอ
ได้งา
่ ยระหว่างอุปกรณ์ทต
ี่ า
่ งก ัน
ประกอบด้วย

Syntax



Semantics



Data formats = รูปแบบของข ้อมูล, เฟรม, การเข ้ารหัส
ั ญาณทีแ
Signal levels=ลักษณะของสญ
่ ทนข ้อมูล
ื่ สาร
Control information=การควบคุมการสอ
Error handling=การจัดการกับ Error
Timing


Speed matching=กาหนดอัตราการสง่
Sequencing=กาหนดลาดับของข ้อมูล
Protocol Architecture
(Protocol Stack)





ื่ สารเป็นเรือ
เนือ
่ งจากการสอ
่ งที่
ั อ
้ น เราแบ่งการสอ
ื่ สารทงหมด
สล ับซบซ
ั้
ออกเป็น Module
แต่ละ Module มีหน้าทีเ่ ฉพาะของม ัน
ื่ สารระหว่าง
แต่ละ Module จะมีการสอ
Module อืน
่
แต่ละ Module มี Protocol กาก ับ
ั้ เรียก Protocol
ปกติจะแบ่งเป็นลาด ับชน
Stack หรือ Protocol Architecture
Protocol Architecture
(Protocol Stack)


Protocol Architecture ทีเ่ ป็นมาตรฐาน
มีสองอ ัน
7 Layer OSI Reference Model ของ
ISO


้
้ น Reference
ปั จจุบน
ั ไม่ได ้ใชงานจริ
ง แต่ใชเป็
ั้
TCP/IP Protocol Suite (มี 5 ชน)


ื่ สารเกือบจะทัง้ หมด
การสอ
มาตรฐานของ Internet
7 Layer OSI
Reference Model
7 Layer

Layer 1: Physical Layer


Layer 2: Data Link Layer


ื่ มต่อผ่าน Physical Medium รับผิดชอบ
ทาหน ้าทีเ่ ชอ
ั ญาณ เรือ
แปลงบิตเป็ นสญ
่ งของการ Interface, สายนา
ั ญาณ ,มองเห็นข ้อมูลในลักษณะ Bit Stream
สญ
ื่ สารผ่าน
ประกอบข ้อมูลเป็ น Frame, รับผิดชอบในการสอ
แต่ละ Link ทา Error Control, Flow Control ผ่าน Link
Layer 3: Network Layer

รับผิดชอบในการสง่ ข ้อมูลผ่าน Network, หาทิศทาง
ื่ มต่อกับ Layer บนเข ้ากับ Network หลายๆ
ข ้อมูล, เชอ
แบบ มองเห็นข ้อมูลในลักษณะ Packet
7 Layer

Layer 4: Transport Layer


รับผิดชอบการสง่ ข ้อมูลให ้ถูกต ้องจากต ้นทางถึง
ปลายทาง(End-to-End), จัดการในเรือ
่ ง Error
และ Flow Control ในระดับต ้นทางถึงปลายทาง
ข ้อมูลทีส
่ ง่ จะถูกแบ่งเป็ น Segment
Layer 5: Session Layer

ื่ มต่อ(Connection)
ทาหน ้าทีจ
่ ัดตัง้ ดูแล การเชอ
ระหว่าง Applicationต ้นทางและปลายทาง แบ่ง
ื่ มต่อสอ
ื่ สารออกเป็ น Session
การเชอ
7 Layer

Layer 6: Presentation Layer


รับผิดชอบในเรือ
่ งรูปแบบและ Format ของ
ข ้อมูล การทา Encryption รวมถึงการทา Data
ื่ สารได ้
Compression ให ้อยูใ่ นรูปแบบทีส
่ อ
Layer 7: Application Layer

ื่ มต่อกับ Application และผู ้ใช ้
ทาหน ้าทีเ่ ชอ
OSI Environment
ื่ มต่อผ่าน Router
การเชอ
TCP/IP Protocol Architecture



Developed by the US Defense Advanced
Research Project Agency (DARPA) for
its packet switched network (ARPANET)
Used by the global Internet
No official model but a working one.
 Application layer
 Host to host or transport layer
 Internet layer
 Network access layer
 Physical layer
TCP/IP Protocol Architecture
Application
INTERNET
Transport Layer
Internet Layer
Network Access
Physical
Physical Layer





Physical interface between data
transmission device (e.g.
computer) and transmission
medium or network
Characteristics of transmission
medium
Signal levels
Data rates
etc.
Network Access Layer





Exchange of data between end
system and network
Destination address provision
Invoking services like priority
ปกติมาตรฐานของ TCP/IP จะไม่
ครอบคลุมถึง Layer 1-2
ทวไปเราน
่ั
า TCP/IP เป็น WAN และวาง
บน LAN คือ Ethernet
Internet Layer (IP)




Systems may be attached to
different networks
Routing functions across multiple
networks
Implemented in end systems and
routers
คือ IP Protocol

มีการทางานแบบ Datagram
Transport Layer (TCP)



Reliable delivery of data
Ordering of delivery
ทีส
่ าค ัญมี 2 Protocol

TCP = Transport Control Protocol



Connection Oriented
Guarantee Delivery
UDP = User Datagram Protocol


Connectionless
Best Effort
Application Layer


Support for user applications
e.g. http, SMPT
TCP/IP VS OSI
Application Software
NOS = Window
NIC + Driver
Physical Link
ื่ มต่อด้วย TCP/IP
รูปแบบการเชอ
Addressing ใน TCP/IP



TCP Port หรือ UDP Port = 16 Bit
IP Address, IPv4 = 32 Bit หมายเลข
เครือ
่ ง และหมายเลข Network
Physical Hardware Address

ถ ้าใช ้ TCP/IP บน Ethernet LAN อันนีค
้ อ
ื
Address ของ NIC หรือ MAC Address = 48
Bit
PDU = Protocol Data Unit
TCP Segment
IP Packet / IP Datagram
Frame
Protocol ทีส
่ าค ัญของ TCP/IP
Standard

LAN:






WAN


IEEE 802
Ethernet IEEE 802.3 มียอ
่ ยอีกหลายตัว
WLAN IEEE 802.11, 802.11b, 802.11g,
802.11n,802.11i
PAN-Bluetooth IEEE 802.15
www.ieee.org
มีหลายตัว ทีส
่ าคัญมักจะถูกดูแลโดย OSI (ITU)
TCP/IP



RFC = Request for Comments
มีประมาณ 4000 RFCs
www.faqs.org/rfcs
Physical Layer Basics



Signal, Power, Noise
ื่ สาร
Bandwidth ทีใ่ ชใ้ นการสอ
Channel Capacity




NyQuist
Shannon
SNR, Eb/No
BER
Signal, Power และ Loss

ิ ค์
ข้อมูลจะต้องเปลีย
่ นให้อยูใ่ นรูปแบบทางฟิ สก
่ ผ่าน Medium ได้
ทีส
่ ามารถสง





Medium Copper Wire = Electrical Signal
Medium Air/Vacuum = Radio Signal or Microwave
or LASER
Medium Fiber Optic = Light or LASER
่ ได้ขน
ระยะทางทีส
่ ามารถสง
ึ้ อยูก
่ ับกาล ังของ
ั
สญญาณ(dBW,
dBm)
่ ข้อมูลจะขึน
้ ก ับค่า SNR(dB) หรือ
อ ัตราการสง
ค่า Eb/No(dB)
้ น่วย Decibel
ทาไมต้องใชห
กาลัง
(W)
คานวณค่า Power ทีจ
่ ด
ุ ต่างๆ ยาก
0
ระยะทาง
กาลัง
(dBW)
0
้
คานวณจากสมการเสนตรง
คือใชบั้ ญญัตไิ ตรยางค์
ระยะทาง
การคานวณ

แปลง dB:



กาหนด Power ทีต
่ น
้ ทาง และอ ัตราค่า Loss(dB) ของ
Medium สามารถหา Power ทีจ
่ ด
ุ ใดๆใน Medium ได้
จาก





P(dBW) = 10log(P(W))
P(dBm) = 10log(P(mW))
Power (dB) = Power ต ้นทาง(dB)- Loss ใน Medium (dB)
แปลง dB กลับเป็ นค่า Power(Absolute) โดยใช ้ Inverse Log
หน่วย dB ของ Power จะมี dBW และ dBm
หน่วย dB ของ Loss/Gain จะเป็ น dB เท่านัน
้
ถ้ามีการขยาย หรือ Gain จะนาค่า Gain (dB) ไปบวก
ก ับค่า Power (dB)
ต ัวอย่าง

ั
่ ไปในสายทีม
สญญาณ
5 W สง
่ ค
ี า่ Loss
ั
4 dB ต่อ 100 เมตร จงหาค่าสญญาณใน
สายทีจ
่ ด
ุ 750 เมตร



Power ต ้นทาง = 10log5 = 6.9897 dBW
Loss ในสายเท่ากับ 4x750/100 = 30 dB
ั ญาณทีจ
สญ
่ ด
ุ 750 เมตร = 6.9897-30


= -23.0103 dBW
แปลงกลับเป็ นหน่วย Watt :

P(W) = 10(-23.0103/10) = 5x10-3 W = 5mW
Exercise ไปคิดเอง

6W
จงหาค่า Power ทีป
่ ลายสาย
620 m
Gain
= 50 dB
Loss
= 3 dB/100 m
1.5 km
Loss
= 4 dB/100 m
Gain
= 45 dB
480 m
Loss
= 3 dB/100 m
P=?W
Transmission Impairment

ั
่ สญญาณ
เป็นต ัวข ัดขวางการสง


Attenuation (Loss)
Distortion


Delay Distortion
Noise




Crosstalk
Thermal Noise
Shot Noise
Noise from Environment
Delay Distortion


Only in guided media
Propagation velocity varies with
frequency
Noise (1)


Additional signals inserted
between transmitter and receiver
Thermal




Due to thermal agitation of electrons
Uniformly distributed
White noise
Intermodulation

Signals that are the sum and difference of
original frequencies sharing a medium
Noise (2)

Crosstalk


A signal from one line is picked up by
another
Impulse




Irregular pulses or spikes
e.g. External electromagnetic interference
Short duration
High amplitude
Thermal Noise, Thermal Equivalent,
Effective Noise Temperature







่ ั ของ Molecule(Electron, Proton) เป็น
เกิดจากการสน
คลืน
่ แม่เหล็กไฟฟ้ารบกวน
สสารทีอ
่ ณ
ุ หภูมส
ิ ง
ู กว่า ศูนย์องศาสมบูรณ์(0 degree
Kelvin = -273.16 degree Celcius), แปรผ ันโดยตรง
เป็น White Noise, Gaussian Noise
ด ังนน
ั้ Noise Power Density, N0  T  N0  kT (Degree Kelvin)
เนือ
่ งจากเป็น White Noise, จะมี Density เท่าก ันทุก
ความถี่
่ ก ัน
แต่ Noise จะถูกจาก ัดที่ Bandwidth ของระบบเชน
ด ังนน
ั้ Noise Power, N  N0 B  kTB
k  Boltzman's Constant 1.380310-23W / Hz

Ex. ที่ Room Temp.(25 C)
N0  1.38031023  298 4.1131021W / Hz  203.86dBW / Hz
Channel Capacity

Data rate



Bandwidth



In bits per second
Rate at which data can be communicated
In cycles per second of Hertz
Constrained by transmitter and medium
NyQuist Bandwidth and Shannon
Channel Capacity
NyQuist Bandwidth







If rate of signal transmission is 2B then signal with
frequencies no greater than B is sufficient to carry
signal rate
Given bandwidth B, highest signal rate is 2B
Given binary signal, data rate supported by B Hz is 2B
bps
Can be increased by using M signal levels
C = 2B for Binary Signal(M=2), Baud Rate=Bit Rate
C= 2B log2M ( M-ary Signal ), Baud Rate = R/log2M
In case of No Noise C can be increased by increasing
M
Shannon Capacity Formula






Consider data rate, noise and error rate
Faster data rate shortens each bit so burst
of noise affects more bits
 At given noise level, high data rate means
higher error rate
Signal to noise ratio (in decibels, dB)
SNRdb=10 log10 (signal power/noise
power)
Capacity C=B log2(1+SNR), Shannon
channel capacity, SNR is not in dB
This is error free capacity
Digital data rate and error rate




ในระบบ Analog Communication ทีเ่ ราสนใจคือ SNR
ั
เพราะแสดงถึงคุณภาพของสญญาณ
ในระบบ Digital Communication เราสนใจ Data Rate
่ ได้ และ Error Rate ทีเ่ กิดขึน
้ เพราะมีผลต่อ
ทีส
่ ง
ิ ธิภาพของระบบ
ประสท
ด ังนน
ั้ SNR จะไม่บอกทงหมดใน
ั้
Digital System เราต้อง
หาต ัวว ัดต ัวอืน
่
้ อ
ทีใ่ ชค
ื Energy Per Bit/ Noise Energy(Eb/No)
Eb  S / R, N0  kT ,  Eb / N0  S / kTR  S / N  B / R
S
Eb / N0 (dB)  10log10 [ kTR
]  10log10 [ NS  BR ]  SNR(dB) 10log10 [R / B]


ั ันธ์ก ับ BER(Bit Error Rate) ในแต่ละระบบ
ค่านี้ สมพ
B เท่าเดิม แต่เพิม
่ R เราเพิม
่ Bandwidth Efficiency แต่
้
จะลด Eb/No ทาให้ BER เพิม
่ ขึน
BER and Eb/No
สรุปสูตรการคานวณ








Power in dBw = 10log10 (Power in watt)
Power in dBm = 10log10 ( power in mw)
Signal-to-Noise Ratio = power of signal/power of
noise
S 
10
log
SNR(dB)=
10 

N 
NyQuist Rate, C  2B log2 M
Shannon Channel Capacity, C  2B log2 [1  S / N ]
Thermal Noise(Thermal Equivalent)
 Noise Energy, N0  kT , k  Boltzman'
sconstant 1.38031023 J /  K
 Noise Power, N  N0 B  kTB
Eb / N 0 
S/R
S
S B

 . , Eb / N 0 (dB)  SNR(dB)  10log10 ( R / B)
N0
kTR N R
Examples (ให้อา
่ นเอง)



1. เครือ
่ งร ับมีคา
่ Effective Noise Temperature
เท่าก ับ 100 องศาเคลวิน และมี Bandwidth = 10
MHz จงคานวณหาค่า Thermal Noise เป็น dBW
ื่ สารกระทาที่ Spectrum ระหว่าง 3
2. ระบบการสอ
MHz และ 4 MHz และมีคา่ SNR 24 dB จงหาว่า
่ Data ในอ ัตราได้สง
้ ามารถสง
ระบบนีส
ู ทีส
่ ด
ุ เท่าไร
ั
่ สญญาณเป
และในกรณีนต
ี้ อ
้ งสง
็ นกีร่ ะด ับ
3. ในระบบ BPSK(Binary Phase Shift Keying)
ต้องการค่า Eb/No ไม่ตา
่ กว่า 8.4 dB เพือ
่ ให้คา
่
BER อยูต
่ า
่ กว่า 1/10000 ถ้าค่า Effective Noise
Temperature ของระบบเท่าก ับ 290 K และ Data
่ เท่าก ับ 2400 bps จงคานวณหาระด ับ
Rate ทีส
่ ง
ั
ของสญญาณที
ต
่ อ
้ งการทีเ่ ครือ
่ งร ับ
Example 1

1. เครือ
่ งร ับมีคา่ Effective Noise
Temperature เท่าก ับ 100 องศาเคลวิน และมี
Bandwidth = 10 MHz จงคานวณหาค่า
Thermal Noise เป็น dBW
N  KTB  1.381023  37310106  5.1471014 W
 10 log10 (5.1471014 ) dBW
 132.88 dBW
Example 2

ื่ สารกระทาที่ Spectrum ระหว่าง 3
2. ระบบการสอ
MHz และ 4 MHz และมีคา
่ SNR 24 dB จงหาว่าระบบนี้
่ Data ในอ ัตราได้สง
สามารถสง
ู ทีส
่ ด
ุ เท่าไร และในกรณี
ั
่ สญญาณเป
้ อ
นีต
้ งสง
็ นกีร่ ะด ับ



Shannon Channel Capacity,
B=1 MHz, S / N  102.4  251.2
a) ดังนัน
้ C  106 log10 252.2  106 2.4017  8 Mbps
log10 2



C  B log2 (1  P / N )
0.3010
จาก C  2B log2 M ( NyQuist Capacity)
เราได ้ 8 106  2 106 log M
2
b)
M  24  16 level
Examples

3. ในระบบ BPSK(Binary Phase Shift Keying) ต้องการค่า Eb/No
ไม่ตา
่ กว่า 8.4 dB เพือ
่ ให้คา่ BER อยูต
่ า
่ กว่า 1/10000 ถ้าค่า
Effective Noise Temperature ของระบบเท่าก ับ 290 K และ Data
ั
่ เท่าก ับ 2400 bps จงคานวณหาระด ับของสญญาณที
Rate ทีส
่ ง
่
ต้องการทีเ่ ครือ
่ งร ับ
Eb
S
(dB)  10 log10 (
)  8.4 dB
N0
kTR
T  290, R  2400
S
S
8.4  10 log10 (
)

10
log
10
1.381023  290 2400
9.6 1018
10[log10 S  log10 9.6 1018 ]  8.4
10 log10 S  8.4  10 log10 9.6 1018  8.4  170.2  161.8
 161.8 dBW
S  1016.18  6.6 1017 W
Line Coding

่ Pulse เพือ
การสง
่ ทีจ
่ ะแทน Data แต่ละ
บิต



Pulse 2 ระดับ = Binary Signal
M-ary Signal จะใช ้ M ระดับ
ข้อควรคานึง


Average DC เป็ นศูนย์หรือไม่
Signal Transition มากเพียงพอ
NRZ
Biphase
Biphase

Manchester
Transition in middle of each bit period
 Transition serves as clock and data
 Low to high represents one (ทีก
่ งึ่ กลาง Bit)
 High to low represents zero (ทีก
่ งึ่ กลาง Bit)
 Used by IEEE 802.3(Ethernet = 10 Mbps)
Differential Manchester
 Midbit transition is clocking only
 Transition at start of a bit period represents zero
 No transition at start of a bit period represents one
 Note: this is a differential encoding scheme
 Used by IEEE 802.5(Token Ring)


Bipolar-AMI+Scrambling
Scrambling;
B8ZS vs HDB3










Bipolar With 8 Zeros Substitution
Based on bipolar-AMI
If octet of all zeros and last voltage pulse preceding was
positive, encode as 000+-0-+
If octet of all zeros and last voltage pulse preceding was
negative, encode as 000-+0+Causes two violations of AMI code
Unlikely to occur as a result of noise
Receiver detects and interprets as octet of all zeros
High Density Bipolar 3 Zeros
Based on bipolar-AMI
String of four zeros replaced with one or two pulses
Voltage ก่อน
หน้า
จานวน ‘1’ คี่
จานวน ‘1’ คู่
-
000-
+00+
+
000+
-00-
Multiplexing

ั
่ สญญาณได้
เป็นวิธก
ี ารทีจ
่ ะสามารถสง
หลายคู่
บน Transmission Medium เดียวก ัน

FDM = Frequency Division Multiplexing


ั ญาณแต่ละคูใ่ น Bandwidth (ชว่ งความถี)่ ต่างกัน
สญ
TDM = Time Division Multiplexing


ั ญาณแต่ละคูส
สญ
่ ง่ ทีเ่ วลาต่างกัน
แบ่งเป็ น


Synchronous TDM: แบ่งเวลาเป็ น Channel ตามจานวนคู่ คูห
่ นึง่
จะใช ้ Channel เบอร์ทก
ี่ าหนดเท่านั น
้
่ กัน แต่ไม่กาหนด คูใ่ ด
Statistical TDM แบ่งเป็ น Channel เชน
ต ้องการสง่ ข ้อมูลให ้จอง Channel เพือ
่ สง่ ดังนั น
้ ในการสง่ ข ้อมูล
ครัง้ หนึง่ ๆ อาจจะใช ้ Channel แตกต่างกัน
FDM vs TDM
Statistical TDM Frame
Formats
Asymmetrical Digital
Subscriber Line


ADSL
Link between subscriber and
network


Local loop
Uses currently installed twisted
pair cable


Can carry broader spectrum
1 MHz or more
ADSL Design

Asymmetric


Greater capacity downstream than
upstream
Frequency division multiplexing

Lowest 25kHz for voice




Plain old telephone service (POTS)
Use echo cancellation or FDM to give two
bands
Use FDM within bands
Range 5.5km
ADSL Channel Configuration
Discrete Multitone






DMT
Multiple carrier signals at different frequencies
Some bits on each channel
4kHz subchannels
Send test signal and use subchannels with
better signal to noise ratio
256 downstream subchannels at 4kHz
(60kbps)
 15.36MHz

Impairments bring this down to 1.5Mbps to
9Mbps
DTM Bits Per Channel
Allocation
่ ข้อมูล Digital
Mode ของการสง


Timing problems require a
mechanism to synchronize the
transmitter and receiver
Two solutions


Asynchronous
Synchronous
Asynchronous Communicaton

Data transmitted on character at a
time



5 to 8 bits
Timing only needs maintaining
within each character
Resynchronize with each character
Asynchronous (diagram)
Asynchronous - Behavior








In a steady stream, interval between
characters is uniform (length of stop
element)
In idle state, receiver looks for transition
1 to 0
Then samples next seven intervals (char
length)
Then looks for next 1 to 0 for next char
Simple
Cheap
Overhead of 2 or 3 bits per char (~20%)
Good for data with large gaps (keyboard)
Data Communications
Interfacing
Characteristics of Interface

Mechanical


Electrical


Voltage, timing, encoding
Functional


Connection plugs
Data, control, timing, grounding
Procedural

Sequence of events
V.24/EIA-232-F



ITU-T v.24
Only specifies functional and procedural
 References other standards for electrical and
mechanical
EIA-232-F (USA)
 RS-232
 Mechanical ISO 2110
 Electrical v.28
 Functional v.24
 Procedural v.24
Mechanical Specification
Electrical Specification






Digital signals
Values interpreted as data
or control, depending on
circuit
Less than -3v is binary 1,
more than +3v is binary 0
(NRZ-L)
Signal rate < 20kbps
Distance <15m
For control, Less than-3v
is off, +3v is on
3-wire and 5-wire RS-232


A minimal "3-wire" RS-232 connection
consisting only of transmit data, receive data,
and ground, is commonly used when the full
facilities of RS-232 are not required. Even a
two-wire connection (data and ground) can be
used if the data flow is one way (for example,
a digital postal scale that periodically sends a
weight reading, or a GPS receiver that
periodically sends position, if no configuration
via RS-232 is necessary).
When only hardware flow control is required in
addition to two-way data, the RTS and CTS
lines are added in a 5-wire version.
Null Modem: DTE to DTE


RS-232-C Null Modem Cable (for Terminal/PC with 25pin Connector)
RS-232-C Null Modem Cable (for Terminal/PC with 9-pin
Connector)
Null Modem
Summary Null Modem
Simple Null Modem
without Handshaking
Null Modem
With Loop-Back Handshaking
Null Modem
With Partial Handshaking
Null Modem
With Full Handshaking
Synchronous - Bit Level



Block of data transmitted without
start or stop bits
Clocks must be synchronized
Can use separate clock line



Good over short distances
Subject to impairments
Embed clock signal in data


Manchester encoding
Carrier frequency (analog)
Synchronous - Block Level


Need to indicate start and end of
block
Use preamble and postamble



e.g. series of SYN (hex 16) characters
e.g. block of 11111111 patterns ending in
11111110
More efficient (lower overhead)
than async
Synchronous (diagram)
Flow Control/Error Control

่
เราควบคุมการใหลข้อมูลเพือ
่ ไม่ให้ผส
ู้ ง
่ ข้อมูลเกินกว่าผูร้ ับจะร ับได้
สง


ั ญาณพร ้อมทีจ
เมือ
่ สง่ ข ้อมูลแล ้ว ให ้รอสญ
่ ะรับ
ข ้อมูลอันต่อไปจากผู ้รับ
้ ะใชร้ ว่ มก ับ Error
ปกติ Mechanism นีจ
Control โดยเมือ
่ มี Error จะใชว้ ธ
ิ ก
ี าร
Retransmission

เราเรียกรวมว่า ARQ = Automatic Repeat
Request
Model of Frame Transmission
Stop and Wait Flow Control
d
T
Efficiency = d/T x 100%
Sliding Window Diagram
Example Sliding Window
Stop and Wait Diagram
1.
2.
แต่ละ Frame ทีส
่ ง่ กาหนด Timer
Frame Sequence ใช ้ 1 Bit สาหรับตรวจ Frame ซ้า
ในทางปฎิบต
ั ิ การ Acknowledge จะใช ้ Piggyback
้
สาหรับใน Microprocessor อาจจะใชสาย
Ack แยกต่างหาก
Go Back N Diagram
1.
2.
3.
แต่ละ Frame ทีส
่ ง่ กาหนด Timer
ขนาด Window สูงสุดไม่เกิน 2n-1
เมือ
่ มี Error ให ้เริม
่ สง่ ใหม่ตงั ้ แต่ Frame นั น
้
ในทางปฎิบต
ั ิ การ Acknowledge จะใช ้ Piggyback
Selective Reject Diagram
1.
2.
3.
แต่ละ Frame ทีส
่ ง่ กาหนด Timer
ขนาด Window สูงสุดไม่เกิน 2n-1
เมือ
่ มี Error สง่ ใหม่เฉพาะ Error Frame
ในทางปฎิบต
ั ิ การ Acknowledge จะใช ้ Piggyback
WAN

WAN

Public Network





ื่ มต่อปกติจะผ่าน Network ของผู ้ให ้บริการ หรือ
การเชอ
Service Provider เราไม่ได ้เป็ นเจ ้าของ
เป็ นลักษณะการเชา่ จ่ายตามจานวนทีใ่ ช ้ เวลา/จานวน
ข ้อมูล
ระยะทางไกลกว่า
้
ื่ มต่อ แตกต่างกัน
Technologies ทีใ่ ชในการเช
อ
Network


Circuit Switching Network
Packet Switching Network
Circuit Switching Network


ั
สาหร ับเครือข่ายโทรศพท์
ั
ล ักษณะข้อมูลและสญญาณเป
็ น Real-Time




ยอมให ้มี Error ได ้บ ้าง
ค่า Delay และ Delay Variation จะถูกจากัดไม่ให ้เกินค่าที่
กาหนด
ด ังนนเพื
ั้
อ
่ ให้ NW สามารถรองร ับความต้องการได้
่ และผูร้ ับจะต้องมีวงจรเชอ
ื่ มต่อ (Circuit) ที่
ทงผู
ั้ ส
้ ง
่ นต ัว จะใชร้ ว่ มก ันไม่ได้ = Dedicate Circuit
เป็นสว
อย่างไรก็ตาม เพือ
่ ประหย ัด Resource ต ัววงจร
้ ามารถให้คนอืน
ด ังกล่าวจะแบ่งก ันใช ้ ถ้าผูใ้ ดไม่ใชส
่
้ อ
ใชไ้ ด้ และการใชต
้ งมีการจอง
Circuit Switching Network


อย่างไรก็ตาม เพือ
่ ประหย ัด Resource ต ัววงจร
้ ามารถให้คนอืน
ด ังกล่าวจะแบ่งก ันใช ้ ถ้าผูใ้ ดไม่ใชส
่
้ อ
ใชไ้ ด้ และการใชต
้ งมีการจอง
ด ังนนการใช
ั้
ง้ านจะแบ่งเป็น 3 Phase



1. Connection เพือ
่ ขอ Circuit โดยการหมุนเลขหมายไปยัง
ปลายทาง ตัว Network จะหาทิศทาง กาหนดว่าใช ้ Link ไหน
และผ่าน Node = Switch อะไรบ ้าง ถ ้าทิศทางว่าง และผู ้รับทา
การรับสาย วงจรนัน
้ จะถูกจองไว ้
ั ท์คอ
ี ง
2. Data Transfer ในกรณีโทรศพ
ื เสย
้ ้ว สว่ น Resource ต่างๆทีถ
3. Disconnection เมือ
่ ไม่ใชแล
่ ก
ู
้ ้
จองไว ้จะถูกสง่ คืน และ Network สามารถนาไปให ้ผู ้อืน
่ ใชได
Simple Switched Network
Simple Switched Network
Simple Switched Network
Simple Switched Network
Simple Switched Network
Simple Switched Network
BLOCKING
Simple Switched Network
B  D
Finish
BLOCKING
Simple Switched Network
B  D
Finish
BLOCKING
Simple Switched Network
B  D
Finish
Public Circuit Switched
Network
ลักษณะการทางานของตัว Switching ใน Circuit Switching Network
Circuit Switch

่ Data
เมือ
่ นามาสง


ผ่านอุปกรณ์ MODEM = Modulator/Demodulator
่ ข้อมูลปกติจะเป็น Burst คือ
พฤติกรรมการสง
่ แต่เมือ
่ จะสง
่ ข้อมูลทีละมากๆ
นานๆจะสง
่ สง




ั ้ ๆ ถ ้า Page
การดู WEB Page เรา Load Web ในชว่ งเวลาสน
ั ้ ๆนัน
มีขนาดใหญ่ ข ้อมูลจานวนมากจะถูกสง่ ในเวลาสน
้
เราอ่าน Web Page เราไม่ได ้ใช ้ Network Bandwidth ปกติ
้
เราจะใชเวลาอ่
านนานกว่าการ Load
ี ไป ไม่ได ้ใชงาน
้
Circuit ทีจ
่ องไว ้ เวลาสว่ นใหญ่จะเสย
แต่คน
้ ได ้
อืน
่ ใชไม่
ิ ธิภาพจะตา่
ประสท
Circuit Switch


้ าหร ับการเชอ
ื่ มต่อระหว่าง Site ทีไ่ ม่ตอ
ใชส
้ งการ
่ ข้อมูลแบบ Real-Time แบบ Off Line
สง
่ การเชอ
ื่ มต่อระหว่างสาขา และสง
่ ยอดขาย
เชน
ประจาว ันมาย ังสาน ักงานใหญ่ ว ันละ 1 ครงั้





ั ท์
เมือ
่ จะสง่ ต่อ Modem ผ่านสายโทรศพ
สง่ ข ้อมูล
หยุดการติดต่อ
ั ทางไกล ในเวลาสนๆ
ั้
ราคาถูก จ่ายค่าโทรศพท์
ปัจจุบ ัน Internet ราคาไม่แพง และต่อ Online
ได้ ด ังนนวิ
ั้ ธน
ี น
ี้ ับว ันจะหมดไป
Example
Modem
Modem
Huahin
Chiang Mai
ั ท์
เครือข่ายโทรศพ
Bangkok
Modem
Modem
Koraj
Packet Switching Network


่ ข้อมูล
Circuit Switching ไม่เหมาะสมสาหร ับการสง
เราใช ้ Packet Switching


ข ้อมูลจะถูกตัดเป็ น Packet สง่ ออกไป
ิ ธิภาพสูงกว่า
ในหนึง่ Circuit สามารถแชร์กน
ั ได ้หลายคน ทาให ้ประสท


ิ ธิภาพสูงกว่า ถ ้าเรา Share กันเพียง Circuit เดียว เมือ
ประสท
่ ผู ้ใดไม่สง่
คนอืน
่ สง่ ได ้




้
้ ้ทันที ไม่ถก
Online จะใชสามารถใช
ได
ู Block
้
ถ ้าสง่ พร ้อมกันหลายคนก็ทาได ้ แต่ละคนจะใชเวลาในการส
ง่ มากขึน
้ เรียกว่า
เกิด Delay
หลายข ้อมูล ของหลายคนใช ้ Circuit เดียว
แต่ละคนคิดว่าตัวเองเป็ นเจ ้าของ Circuit คนเดียว = Transparency
อย่างไรก็ตามข ้อมูลจริงๆ วิง่ อยูบ
่ น Circuit เดียวกัน ต ้องมีวธิ บ
ี ง่ บอก


Address ผู ้สง่ และผู ้รับ แปะทีส
่ ว่ น Header ของข ้อมูล
หรือ ใช ้ Virtual Circuit Number สาหรับแต่ละคน และแปะทีส
่ ว่ นหัวข ้อมูล
Packet Switching Network




เนือ
่ งจากต้อง Share วงจรก ัน เพือ
่ ป้องก ันไม่ให้
ผูใ้ ดผูห
้ นึง่ ผูกขาดการใชง้ าน ต้องกาหนดขนาด
่ สง
่ ได้ในแต่ละครงั้ = MTU,
ข้อมูลสูงสุดทีผ
่ ส
ู้ ง
Maximum Transfer Unit
ถ้าข้อมูลใหญ่กว่านน
ั้ ต้องแบ่ง หรือต ัดข้อมูลเป็น
่ นห ัว
Packet ย่อยๆ แต่ละ Packet มีสว
นอกเหนือจาก Address/VC แล้ว จะต้องมี
Sequence Number บ่งบอกลาด ับของข้อมูล
กระทาโดย Protocol ผูใ้ ช ้ (Application) ไม่
ต้องทา
นีค
่ อ
ื Packet Switching Network
Packet Switched Network
Packet Switched Network
Packet Switched Network
Packet Switched Network
Advantages

Line efficiency



Data rate conversion


ื่ มต่อกับ Local Node ด ้วยความเร็วที่
Each station เชอ
ตัวเองกาหนด
Packets are accepted even when network
is busy โดยเก็บไว้ใน Queue


แต่ละ Link สามารถจะ Share กันได ้
Packets ทีเ่ ข ้ามาแต่ละ Node จะถูกเข ้า Queue เพือ
่
สง่ ออกไป
Delivery may slow down = Delay
Priorities can be used
Packet Switching Network

2 Concepts กาหนดการทางานใน
Network (Switching Technique)



Datagram
Virtual Circuit
ื่ มต่อก ับ
2 Concepts กาหนดการเชอ
้ ายนอก (User Interface,
ผูใ้ ชภ
Network Service)


Connection Oriented
Connectionless
Switching Technique



Station breaks long message into packets
Packets sent one at a time to the network
Network จะจ ัดการ Packet สองแบบ (การทางานของ
Network = L3)

Datagram



้ ้โดยตรง และทาการสง่ โดยดูจาก Address
Network รับข ้อมูลจากผู ้ใชได
ปลายทางทีส
่ ว่ นหัวของข ้อมูล ทิศทางของข ้อมูลจะทาการหา เมือ
่ ข ้อมูลแต่
ละ Packet ไปถึงในแต่ละ Node
้ ศทางไม่เหมือนกัน (Flexibility)
แต่ละ Packet อาจจะใชทิ
Virtual circuit


Network จะต ้องทา Connection หรือหาทิศทางก่อน โดยดูจาก Address
ปลายทาง จากนั น
้ จะกาหนด Connection ด ้วย Virtual Circuit Number,
การสง่ ข ้อมูลไม่ต ้องกาหนด Address อีกต่อไป เพียงแต่อ ้างอิงจาก Virtual
Circuit Number ก็พอ
้ ศทางเดียวกัน แม ้ว่าไม่ Flexible เท่า Datagram แต่
ทุก Packet จะใชทิ
ข ้อมูลจะสง่ ได ้รวดเร็วกว่า เพราะการหาทิสทางทาครัง้ เดียว เมือ
่ ทา
Connection
Different Services of Network
(Mostly Layer 4) เมือ
่ มองจากผูใ้ ช ้

Connection Oriented



Must perform connection to the network before sending data
the result is a connection number to reference, reliable
communication from end-to-end
 Connection Oriented on Virtual Circuit is used in packet
switching network
 Connection Oriented on datagram is used in IP network
(TCP/IP)
Connectionless

Do not guarantee delivery but fast and efficient for small data
transmission
้
 Connectionless on VC ไม่พบการใชงาน
 Connectionless on datagram is used in IP network (UDP/IP)
สรุป Packet Switching
Network

2 Concepts กาหนดการทางานใน
Network(L3)



Datagram
Virtual Circuit
ื่ มต่อก ับผูใ้ ช ้
2 Concepts กาหนดการเชอ
ภายนอก (ปกติจะอยูใ่ น L4)


Connection Oriented
Connectionless
การทางานของ Datagram






Each packet treated independently
Packets can take any practical route
Packets may arrive out of order
Packets may go missing
Up to receiver(ปลายทาง) to re-order
packets and recover from missing
packets
สรุปแล้ว การทางานของ Network ประเภทนี้
่ ข้อมูล
จะไม่ Guarantee การสง
Datagram
Diagram
Virtual Circuit






Preplanned route established before any packets
้ ทางจะถูกกาหนดในชว
่ งการ Connection
sent เสน
Call request and call accept packets establish
connection (handshake) กาหนด Connection ด้วย
ต ัวเลข คือ VC Number
Each packet contains a virtual circuit identifier
instead of destination address
No routing decisions required for each packet ดู
จาก VC # ก็เพียงพอ
Clear request to drop circuit เมือ
่ จบ
Not a dedicated path แต่มองจากผูใ้ ชเ้ หมือน Circuit
Switching
Virtual
Circuit
Diagram
Virtual Circuits vs Datagram

Virtual circuits




Network can provide sequencing and error control
Packets are forwarded more quickly
 No routing decisions to make
Less reliable
 Loss of a node looses all circuits through that node
Datagram


No call setup phase
 Better if few packets
More flexible
 Routing can be used to avoid congested parts of
the network
Circuit vs Packet Switching

Performance



Propagation delay
Transmission time
Node delay
Event Timing เปรียบเทียบ 3 NW
HW1 Due Next Week
ึ ษา Download HW 1, Week 1
ให้น ักศก
ทาการพิมพ์คาถามบนกระดาษ A4 จากนนให้
ั้
ทาการบ้าน
ลงในกระดาษทีพ
่ ม
ิ พ์ ด้วยการเขียนเท่านน(ห้
ั้
ามพิมพ์)
ั
่ ต้นชว่ ั โมง สปดาห์
และสง
ถ ัดไป
่ อ
ื่ รห ัส และ Section ในหน้าแรก
อย่าลืมใสช
End of Week 1


End of Review Part I
Next Week Review Part II

LAN and LAN Technologies