120 likes | 276 Views
TCP/IP Application Model. Application. TCP. UDP. IP. Network Protocols. Protocol Stack. UDP Connectionless Transport Protocol. UDP extends the host-host delivery service of the underlying network into a process-process communication service.
E N D
TCP/IP Application Model Application TCP UDP IP Network Protocols Protocol Stack
UDP Connectionless Transport Protocol UDP extends the host-host delivery service of the underlying network into a process-process communication service. • Provides a multiplexing/demultiplexing service to allow multiple processes on each host to share the network. • Ensures correctness of the message by use of a checksum. • Adds no other functionality beyond “best effort” delivery service of the underlying network.
0 16 31 UDP Header Format Destination Port Source Port Checksum Length Data
Determining the UDP Checksum PseudoHeader UDP Length Protocol Pad = 00000000 Source IP Address Destination IP Address Source Port Destination Port Length Checksum Data UDP Datagram
Application process Application process Application process UDP Ports Queues Packets demultiplexed Packets arrive
TCP a Reliable Byte Stream Protocol TCP (Transport Control Protocol) is a connection oriented protocol that guarantees the reliable, in-order delivery of a stream of bytes. • TCP is full-duplex (it supports a pair of byte streams flowing in opposite directions.) • It provides for flow control which allows a receiver to limit the rate at which a sender can transmit. • It implements a congestion control mechanism which throttles the sender from overloading the network. • Like UDP, it provides for multiplexing/demultiplexing of packets
TCP Packet Format For reliable, in order delivery For flow control For process demultiplexing Other fields Destination Port Source Port Sequence Number (byte count) Acknowledgement 0 Flags Advertised Window HdrLen Checksum Urgent Pointer Options (variable length) Data
SrcPort=21 DstPort=13 ScrPort=13 DstPort=21 ScrPort=13 DestPort=21 SEQ = 1234 SEQ = 6789 SEQ = 1235 ACK = xxxx ACK = 1235 ACK = 6790 5 5 0 0 SYN ACK 1024 1024 5 0 SA 2048 Checksum NIL Checksum NIL Checksum NIL Receiver sends acceptance Initiator prepares ACK Initiator sends ACK The Three-way Handshake Initiator Receiver ScrPort=13 DstPort=21 ScrPort=21 DstPort=13 ScrPort=13 DestPort=21 SEQ = 1235 SEQ = 1234 SEQ = 6789 ACK = 6790 ACK = xxxx ACK = 1235 5 5 0 0 SYN ACK 1024 1024 5 0 SA 2048 Checksum NIL NIL Checksum Checksum NIL Receiver prepares acceptance Initiator sends request to Receiver
Demonstration of TCP Byte Transfer TCP Demonstration This applet demonstrates an initial 3-way handshake to establish a TCP connection, then illustrates the use of the advertised window to regulate the exchange of bytes between the two hosts. Current limitations: Buttons are not installed, the processing time is taken to be about 25 seconds for easier viewing.
Host B’s State CLOSED active open/SYN passive open close LISTEN LISTEN LISTEN SYN / SYN+ACK Send/SYN SYN_RCVD SYN_SENT SYN / SYN+ACK ACK Close / FIN SYN+ACK / ACK ESTABLISHED FIN / ACK Close / FIN CLOSE_WAIT FIN_WAIT_1 FIN / ACK Close / FIN ACK LAST_ACK CLOSING FIN_WAIT_2 ACK ACK ACK+FIN / ACK TIME_WAIT CLOSED FIN / ACK Host A’s State A Sends SYN TCP Connection Closed Connected A Initiates Close LISTEN SYN_RCVD SYN_RCVD SYN_SENT SYN_SENT ESTABLISHED ESTABLISHED CLOSE_WAIT CLOSE_WAIT FIN_WAIT_1 FIN_WAIT_1 LAST_ACK LAST_ACK FIN_WAIT_2 FIN_WAIT_2 TIME_WAIT TIME_WAIT CLOSED CLOSED
Port: An abstraction for locating services Each service is associated with a given port number on a given machine. When you ask for a particular port, you are requesting the service associated with that port number. There are 2 ** 16 available numbers, but the numbers 1 – 1024 are reserved for “well-known” services and should not be used for user initiated services. Port number 7 is used for the echo server and Port number 13 is used for the time and date service It is up to the client to know which port number the desired service is running on.