1 / 7

Review: UDP: What is the difference between UDP and TCP? Why UDP? UDP service interface?

Review: UDP: What is the difference between UDP and TCP? Why UDP? UDP service interface?. #include <sys/socket.h> ssize_t recvfrom(int sockfd, void *buff, size_t nbytes, int flags, struct sockaddr *from, socklen_t *addrlen);

conway
Télécharger la présentation

Review: UDP: What is the difference between UDP and TCP? Why UDP? UDP service interface?

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. Review: • UDP: • What is the difference between UDP and TCP? • Why UDP? • UDP service interface?

  2. #include <sys/socket.h> ssize_t recvfrom(int sockfd, void *buff, size_t nbytes, int flags, struct sockaddr *from, socklen_t *addrlen); ssize_t sendto(int sockfd, void *buff, size_t nbytes, int flags, const struct sockaddr *to, socklen_t addrlen); Show lost of packets in UDP? What is the error rate? Why? Ethernet error rate: 10^-9 to 10^-12.

  3. Today’s topic: • Reliable communication over UDP. • Problems with UDP communication? • Need flow control and error control

  4. How to do flow control? • Control the speed of the sender – if the receiver does not have enough buffer, stop sending. • How to do it? • Example1.c and example2.c are primitive UDP sender and receiver, how to slow the sender down? • Adding delay (sleep???) • Performing handshaking – this technique is used in TCP. • Do example1.1.c and example2.1.c work?

  5. Example1.1.c and example2.1.c resolve the flow control problem. What would happen if some packet gets lost? • Solution. • Add timeout to the sender • If a packet gets lost, the sender should timeout and resend the packet. • How to implement a timeout mechanism? • See example1.2.c and example2.2.c

  6. Any problems with example1.2.c and example2.2.c? • Some packets get duplicated!! • How to resolve this problem? • The receiver must be able to recognize whether it has received a RIGHT packet – should throw away the duplicated packets!! • How to do this? • Add an identifier to each packet sent – sequence number. • The receiver should record what it receives. • Example1.3.c and example2.3.c implement this reliable protocol.

  7. The protocol implemented in example1.3.c and example2.3.c is called Positive Acknowledgement with Retransmission (PAR) protocol. • A reliable transmission protocol • But not the most efficient • The network (and end hosts) is idle sometimes • Sliding window protocols improve the performance of PAR

More Related