1 / 39

Transport Layer: Understanding UDP vs TCP and Socket Addresses

This agenda covers lecture topics on UDP and TCP, addressing in the transport layer, the position of UDP in the TCP/IP protocol suite, and the client-server paradigm. It also includes information on IANA ranges for port numbers, socket addresses, and the operation of UDP in terms of connectionless services, flow and error control, and encapsulation.

lucast
Download Presentation

Transport Layer: Understanding UDP vs TCP and Socket Addresses

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Today’s Agenda • NOTE: Presentations will start 5:15PM vs 5PM – allow a little time to prep with team • Cover Lecture 19 and 20 today • SURPRISE: Will review Exam 3 tonight versus 7/25/17 • As a result, Exam 4 will start at 5pm versus 5:20pm • Syllabus was updated Lecture

  2. Question 1 to Students Transport Layer- Chapter 14 - UDP • What is the Transport Layer’s function/job/objective ????? • What are some of the tasks in implementing the “objective” Lecture

  3. In simple terms prior to the lecture, explain the difference between UDP and TCP Question 2 to Students What’s their understanding, if any, between UDP and TCP. Lecture

  4. In simple terms prior to the lecture, re-explain the different levels of addressing (focusing on the transport layer) Port Address (Port Number)Network Address (Logical Address) – i.e. IP AddressPhysical Address (Hardware Address) – i.e MAC Address Lecture

  5. Position of UDP in the TCP/IP protocol suite • Now we move to the Transport Layer: consist of TCP and UDP • The Transport Layer protocols function between the network operations (hop-to-hop) and the Application Programs • Recall: transport protocols are implemented at the source Tx and destination Rx • Of the 2 transport protocols, UDP is the more simpler and has less-overhead • Let’s focus on UDP Lecture

  6. UDP versus IP • Transport protocols are responsible for creating process-to-process or end-to-end communication – UDP accomplish this by using port numbers • Also, Transport protocols are responsible for flow and error control – UDP does not implement flow control however, it does implement some minimal error control by dropping packets with errors • The only 2 capabilities UDP adds to IP are: (1) process-to-process communication vs host-to-host communication – sends/receives packets at the port level and (2) some minimum error control • Recall: IP implements host-to-host Lecture

  7. Client-Server Paradigm • A very common example of process-to-process communications is the Client-Server paradigm. Recall our previous discussion • Today’s operating systems can support both multiple users and multiple programming environments • IP addresses id the local and remote hosts • Port numbers id the local and remote processes • UDP generates port number ids for client programs – called ephemeral port numbers • For the client to know exactly which server port to communicate with, universal ports numbers are used for servers, called “well-known port numbers” Lecture

  8. IANA ranges • The IANA (Internet Assigned Numbers Authority) has divided the port numbers into 3 ranges: • Well-Known ports – ports ranging from 0 to 1023 – assigned and control by IANA • Registered ports – ports ranging from 1024 to 49151 – not assigned, but can be registered with IANA in preventing duplication • Dynamic ports – ports ranging from 49152 to 65535 – not assigned or registered – ephemeral ports Lecture

  9. Socket addresses • The combination of IP address and port number is called a socket address • Have client socket address and server socket address • The IP header contains the respective IP addresses • The UDP header contains the respective port numbers Lecture

  10. User datagram format • UDP packets are called user datagrams • Has fixed sized header of 8 bytes • Source port number – the source is the device that’s sending at the time – can be either the client or the serve – port number used by the sender • Destination port number – port number used by the receiver (could be either the client or server) • Length – defines the total length of the user datagram, header plus data • The length field in the user datagram is redundant – recall that the user datagram is encapsulated into the IP datagram. • If we subtract the IP datagram’s header length from it’s total length, the remainder would be the user datagram length. • Checksum – used to detect errors over the entire user datagram Lecture

  11. UDP OPERATION • UDP uses concepts common to the Transport Layer: • Connectionless Services – each user datagram travels independently from source to destination – even if the datagrams are coming from the same source and going to the same destination • Flow and Error Control – there is no flow and error control (only the checksum) – the process using UDP should provide these control mechanisms • Encapsulation –message passed to UDP with 2 socket addresses and the length of the data. UDP then adds the header. Then UDP passes it to IP. IP then adds it’s header. Then to the data link and physical layers. Decapsulation – physical layer decodes the signal into bits and pass to datalink and DL checks for errors. IP then does it’s check then pass to UDP. UDP then uses checksum to check user datagram Lecture

  12. UDP OPERATION CONT… • UDP uses concepts common to the Transport Layer: • Queuing(Client) – client process sends messages to the outgoing queue using the source port specified. • When message arrive to client, UDP checks to see if an incoming queue has been created;. If not created, UDP drops the datagram • Queuing (server) – queues are associated with the well-known ports and remain open as long as the server is running Lecture

  13. UDP OPERATION CONT… • UDP uses concepts common to the Transport Layer: • Multiplexing – on the sender side, several processes needing to use UDP multiplex and then send to the IP – UDP differentiate amongst the multiplexed datagrams via their assigned port numbers • Demultiplexing – on the receiving side, the datagrams are demuxed Lecture

  14. Transmission Control Protocol (TCP) Lecture

  15. Position of TCP in TCP/IP protocol suite • TCP located in the Transport Layer • Recall: UDP only adds some minimal error checking and process-to-process to IP • TCP adds connection-oriented(what does this really mean?) and reliability features on top of IP Lecture

  16. Stream Delivery Lecture

  17. Transport Layer/TCP Responsibilities • Responsible for process-to-process communications (accomplished via the use of port numbers) • Responsible for flow control – uses a “sliding window” protocol to accomplish this • Responsible for error control – uses the acknowledgment packet, time-out and retransmission to accomplish this • Responsible for providing a connection mechanism • TCP Sender: (1) application send streams to transport layer, (2) Tx makes connection with Rx, (3) breaks up stream, (4) assign overhead and number, (5) send one by one • TCP Receiver: (1) wait for all pieces to arrive, (2) error check each piece, (3) deliver error-free pieces to receiving application as a stream, (4) after entire stream has been sent to receiving application, terminate connection Lecture

  18. Stream Delivery Service Cont… • Because the Tx and Rx could operate at different rates, TCP uses buffers at the Tx and Rx. • One example of a buffer: circular array of 1-byte locations (typically in the hundreds or thousands) – buffer locations can be different sizes too • Tx has 3 types of locations: (1) empty (white), (2) sent but not acknowledged yet (gray) and (3) needing to be sent (pink). • Gray locations are recycled after an acknowledgment is received (reason for circle) • Rx has 2 types of locations: (1) empty (white) and (2) received bytes to be consumed (pink) • After the bytes are consumed – the locations a recycled (reason for circle) Lecture

  19. Stream Delivery Continued • Recall: transport layer breaks down the message into smaller pieces for the network layer – smaller pieces called “segments” • TCP adds overhead to each segment – over head deals with flow and error control • TCP segments are encapsulated into the IP datagram • Example: Segments being created from bytes in the buffers (ie. 1 segment created from 5 buffered bytes) Lecture

  20. NUMBERING BYTES • TCP keeps track of segments using numbers relating to the bytes versus the segments • Sequence number and Acknowledgment Number are used and relate to the byte • The start number is randomly generated (versus always being 0) • For example, suppose 1057 is generated and let’s say 6000 bytes need to be sent – the numbering will range from 1057 to 7056 • Byte numbering is also used for flow and error control • After the bytes are numbered, TCP assigns a sequence # to each segment – the sequence # is the first byte number of the segment • The acknowledgment # is sequence # incremented each time a byte is received (ie. take a 4-byte segment with starting sequence # 11, when byte 11 received, ack #=12, when byte 12 received, ack # = 13, etc..) Lecture

  21. Connection establishment using three-way handshake (A) Server starts by telling TCP it can accept a connection – done by doing a “passive open” (2nd) Server sends a SYN + ACK segment (2 bits set) – the ACK acknowledges the client’s SYN segment – and the SYN synchs the server with the client in the opposite direction (implementing full duplex) – the server also sends the desired window size to the client (B) When client is ready to connect – it issues an “active open” to a specific server (1st) Client sends the first segment – the SYN bit (synchronization) is set and it has a randomly generated starting sequence number – carries no data (3rd) Client sends a third segment, with the ACK bit set, to acknowledge the server’s segment – in some cases, the segment can also send the FIRST chunk of data to the server Lecture

  22. TCP - FLOW CONTROL • Flow Control – amount of data a Tx sends before receiving an acknowledgment from the Rx • Can send too much and overwhelm routers and etc.. • Can send too little and Tx stays idle too much waiting for acknowledgments • TCP defines a “window” that’s imposed on the buffer of data delivered • A sliding window is used to make transmission more efficient as well as to control the flow of data so that the destination does not become overwhelmed with data. • TCP’s sliding windows are byte oriented. Lecture

  23. Sender buffer w/o sliding window • Before covering the sliding window concept, considered no sliding window • If all of the pink locations were sent, it could over load the receiver’s buffer Lecture

  24. Receiver window • In describing the sliding window concept, must define a “Receiver Window” • Receiver Window - At any particular time, contains how many more bytes can the receiver store ? • For example, the receiver window below is 7 Lecture

  25. Sender buffer and sender window • We have flow control if the sender’s window is less than or equal to the receiver’s window. Why ? • In the example below, the sender can’t send 7 because 3 were already sent - the Rx hasn’t acknowledged these 3 yet • Therefore, the Tx can only send 4 more and not overload the Rx Sender Window size Lecture

  26. Sliding the sender window • Messages from the receiver change the position of the sender window • For example, suppose the sender sent 2 more bytes and received an acknowledgment from the Rx • If the Tx received an acknowledgment, that means the Rx has consumed bytes 200 – 202 • Now the window can slide over to encompass 203 – 209. Tx Window Lecture

  27. Expanding the sender window If the receiver consumes data faster than it receives, the size of the receiver window expands – this is relayed to the Tx and it’s window is expanded too. Vice versa, If the receiver consumes data slower than it receives, the size of the receiver window shrinks – this is relayed to the Tx and it’s window is reduced too. NOTE: if the Rx is full, the Tx closes it’s window until Rx window is non-zero Lecture

  28. In TCP, the sender window size is totally controlled by the receiver window value.However, the sender’s actual window size can be smaller if there is congestion in the network. Lecture

  29. Some Points about TCP’s Sliding Windows: 1. The source does not have to send a full window’s worth of data. 2. The size of the window can be increased or decreased by the destination. 3. The destination can send an acknowledgment at any time. Lecture

  30. SILLY WINDOW SYNDROME • If the Tx application created data slowly, data would be sent in smaller segments – not enough data to create larger segments • If the Rx application consumed data slowly, the data would be sent in smaller segments in not overloading the Rx. • In either case, network capacity efficiency would be reduced – poor use of network capacity • This is called “Silly Window Syndrome” – why is it “silly” ?? Lecture

  31. Explain the Following How Transport-level flow control works with Data Link-level flow control Lecture

  32. ERROR CONTROL • TCP provides reliability using error control • TCP can detect corrupted segments, lost segments, out-of-order segments and duplicated segments • TCP also has a mechanism in correcting detected errors • Error Detection • Error Detection is achieved through 3 tools: (1) checksum, (2) acknowledgment and (3) time-out • Checksum – checksum is used to determine if a segment is corrupted (recall) – if segment is corrupted, it’s dropped • Acknowledgement – acknowledgement is sent by the Rx when the segment is received • If no acknowledgement is received by the Tx before the time-out timer counts down, then it’s assumed the segment is corrupted or lost • Error Correction • Re-transmit if error is detected Lecture

  33. TCP uses 4 timers • Retransmission Timer – counts down wait time for an acknowledgement from the Rx • Persistence Timer – recall the Rx window being a zero and therefore stopping the Tx. When the Rx needs data from the Tx, it then sends an acknowledgement. Suppose the Rx’s acknowledgement is lost, the Tx counts down and send a probe to the Rx. • Keepalive Timer – suppose Tx opens a connection to Rx then crashes – the connection will remain open – to fix this, the Rx counts down and then send a probe to the Tx • Time-waited Timer – count down right after a connection is terminated – not really closed until this count down is completed – house cleaning (similar to shutting down computer) Lecture

  34. TCP segment format 20-60 bytes • Cover URG, ACK, PSH, RST, SYN and FIN next • Urgent Pointer – used when the segment contains urgent data • Cover Options next Lecture

  35. Control field • These bits or flags enable flow control, connection establishment and termination, connection abortion and the mode of data transfer Lecture

  36. Options • End of Option - used as padding at the end • No operation – used as padding in between options • Maximum segment size- defined the largest possible data size • Window Scale Factor – allows scaling of the sliding window • Time Stamp – Tx fills this field when the segment is sent Lecture

  37. Encapsulation and decapsulation Question to students: What is the relationship among the frame, IP datagram and User datagram ???????????? Lecture

  38. Multiplexing and demultiplexing Lecture

  39. CS4622 Exam 3 Results Average Score = 70 (Average Grade = 85) Score SD = 18 Grading Scaled Used: 98-80 A-grade (4 students) 79-61 B-grade (4 students) 60-42 C-grade (3 students) In getting your grade logged, be sure and pass back the exam after we go over them Dr. Clincy 39

More Related