Download presentation
Presentation is loading. Please wait.
Published byArabella Hoover Modified over 9 years ago
1
CSE 331: Introduction to Networks and Security Fall 2000 Instructor: Carl A. Gunter Slide Set 5
2
Application and Network
3
IPv4 Packet Format l IPv4 (Version field set to “4”) Version Hlen TOS Length Ident Flags Offset TTL Protocol Checksum SourceAddr DestinationAddr Options(variable length) Pad DATA
4
TCP and UDP packets l Protocols support O.S. “port numbers”: SrcPort DstPort Checksum LengthSequenceNum SrcPort DstPort Options (variable) Checksum UrgPtr HL 0 Flags Advert.Wind. Acknowledgment DATA UDPTCP DATA
5
UDP packet format l IP enhancement for Demux and checksum SrcPort DstPort Checksum Length DATA 0 15 31
6
UDP End-to-End Model l Multiplexing/Demultiplexing with Port number UDP Sender (Multiplexer) UDP Receiver (Demultiplexer) Application
7
Port Numbers l O.S. Independent way to specify sender and receiver applications l Limited to 16 bits, so <65536 (64K) l Question: per-host or per-IP address? Usually UNIX does per-host l “Well-known” ports for certain services l Ports used for rendezvous
8
UDP also provides... l A simple checksum covering UDP header, data (message body), and pseudo-header (length, source IP, destination IP), using IP algorithm l Optional in IPv4, mandatory in IPv6 l No: flow control, reliability, ordering, etc. Very little service enhancement over IP
9
TCP l Need reliable, ordered delivery of data l No duplicates l Data units called segments l Transmission Control Protocol Connection-oriented (thus full-duplex) Also provides flow and congestion control
10
TCP End-to-End Model l Buffering corrects errors but may introduce delays Application TCP Sender: Send Buffers TCP Receiver Receive Buffers segment
11
TCP Provides l Ordering using sequence numbers Each byte has a sequence number Risk of overflow increases l Reliability using: acknowledgements checksums sequence numbers
12
Automatic Repeat Request Timeout SenderReceiver Timeout Frame ACK Time
13
ARQ Continued Timeout SenderReceiver Timeout Frame ACK Time
14
ARQ Continued Timeout SenderReceiver Timeout Frame ACK Frame ACK Time
15
ARQ Continued Timeout SenderReceiver Timeout Frame ACK Frame ACK Time
16
Alternating Bit Protocol Timeout SenderReceiver Timeout Frame 0 ACK 0 Timeout Frame 0 ACK 0 Frame 1 ACK 1 Time
17
Sliding Window Protocol SenderReceiver Time
18
SWP Endpoint States Sender Receiver Send Window Size Receive Window Size Last Acknowledgement ReceivedLast Frame Sent Last Frame AcceptableNext Frame Expected
19
End-to-End Issues for TCP l New issues when link is not point to point Setup required Variable capabilities of connections Packet Delay Congestion control required l Compare: X.25 approach
20
Packet Format l Flags SYN FIN RESET PUSH URG ACK l Fields SequenceNum SrcPort DstPort Options (variable) Checksum UrgPtr HL 0 Flags Advert.Wind. Acknowledgment 0 15 31 DATA
21
Three-Way Handshake
22
TCP State Transitions
23
TCP Receiver l Maintains a buffer from which application reads; advertises < buffer size as the window for sliding window l Responds with Acknowledge and AdvertisedWindow on each send; updates byte counts when data O.K. l Application blocked until read() O.K.
24
TCP Sender l Maintains a buffer; sending application is blocked until room in the buffer for its write l Holds data until acknowledged by receiver as successfully received l Implement window expansion and contraction; note difference between flow and congestion control
25
Flow vs. Congestion Control l Flow control protects the recipient from being overwhelmed. l Congestion control protects the network from being overwhelmed.
26
TCP Congestion Control l Additive Increase / Multiplicative Decrease l Slow Start l Fast Retransmit and Fast Recovery
27
Increase and Decrease l A value CongestionWindow is used to control the number of unacknowledged transmissions. l This value is increased linearly until timeouts for ACKs are missed. l When timeouts occur, CongestionWindow is decreased by half to reduce the pressure on the network quickly. l The strategy is called “additive increase / multiplicative decrease”.
28
Slow Start l Sending the entire window immediately could cause a traffic jam in the network. l Begin “slowly” by setting the congestion window to one packet. l When acknowledgements arrive, double the congestion window. l Continue until ACKs do not arrive or flow control dominates.
29
Retransmit and Recovery l Fast retransmit uses duplicate ACKs to anticipate dropped packets. When an out-of-order packet arrives, the receiver sends the previous ACK a second time. When the sender gets a repeat ACK three times, it anticipates that a packet was lost and retransmits. l Fast recovery exploits outstanding ACKs to avoid falling back into a full slow start after a timer expires.
30
Remote Procedure Call l Model of communication support distributed programming in fact tries to hide communication! l Interface between programming language and communications system l Adopts procedure-call interface e.g., remote_foo(arg_1, arg_2);
31
RPC Blocking
32
RPC client and server l RPC client host must know how to reach server and what service is required l RPC server host must know who is requesting the service, what service is requested, and how to reply l Usually built over UDP; issues include argument marshalling, transport, binding, etc. Example: name resolution
33
RPC Stubs
34
Simple RPC Stack Dispatches request messages to the right process Synchronizes request and reply messages Fragments and reassembles large messages
35
The BSD “socket” API l Designed for UNIX, which had “pipes” l Socket provides a “handle” (descriptor) which can be used for system operations such as read() and write() l Other services must exist for rendezvous, synchronization, etc.
36
Making a Socket l int socket(int domain, int type, int protocol) l Domains: PF_INET, PF_UNIX l Types: SOCK_STREAM, SOCK_DGRAM l Example, TCP Socket: socket(PF_INET, SOCK_STREAM, UNSPEC)
37
Passive Open /Active Connect l Server int bind(int socket, struct sockaddr* address, int addr_len) int listen(int socket,...) int accept(int socket, struct sockaddr* address,...) l Client int connect(int socket, struct sockaddr* address, int addr_len)
38
Write and Read l int write(int socket, char* message, int msg_len) l int read(int socket, char* buffer, int buf_len)
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.