Download presentation
Presentation is loading. Please wait.
Published byPolly Cobb Modified over 8 years ago
1
UDP User Datagram Protocol
2
User Datagram Protocol (UDP) UDP is the protocol available to network programmers who wish to send datagrams UDP datagrams are called user datagrams, since they allow user-level creation & transmission of datagrams Other IP datagrams are used for implementation of connection-based transport (TCP), error control (ICMP), or inter-router communication (BGP, RIP, OSPF) UDP has a small, fixed-size (8 byte) header
3
Connectionless Service In connectionless service, a host just sends packets No connection needs to be established No virtual circuit needs to be created A connectionless socket can send messages to multiple recipients
4
UDP Applications UDP can be used for: Instant messaging (e.g. ICQ) Multicast messaging UDP is best suited for applications which have: Sporadic messaging Long periods of delay between messages
5
User Datagrams BytesNameDescription 2Source PortThe port used to send the message 2Dest. PortThe port to be used to receive the message 2LengthThe length of the data in the message 2ChecksumThe checksum of the message data ?DataThe data of the message 8 bytes
6
Ports Ports represent portals where information may be transmitted or received by a network-enabled machine One port may be used to send ICQ messages to other ICQ users Another port may be used to send requests to mail servers (such as SMTP servers) Without ports, messages from the SMTP server or an ICQ user will be indistinguishable
7
Ports It is important to note (and often overlooked) that all datagrams contain 2 ports: One for the source The port that was used to send the message One for the destination The port that was used to receive the message
8
Ports Some ports were associated with specific network functions to make port numbers unnecessary in those domains: 25: SMTP (used for sending E-Mail) 80: HTTP (used for handling web requests) 90: SHTTP (used for handling secure web requests) Some others are listed on p.205 & p.244 These reserved ports are both UDP and TCP ports
9
Ports M2 80 Web 25 SMTP 8080 Tomcat M1 Web 80 Web 90 ICQ 5190 5190 ICQ Ext 10257 Ext 16403
10
User Datagrams UDP datagrams are encapsulated inside IP datagrams The normal IP headers are present The data portion of the IP datagram contains the UDP headers (port numbers, etc.) and the message data
11
UDP Message Encapsulation User DataUDP Header IP DataIP Header Frame DataFrame Header Network Frame
12
UDP Layering Application User Datagram Protocol (UDP) Internet Protocol (IP) Network Interface Hardware
13
UDP Programming // in Java DatagramSocket socket = new DatagramSocket(16789); String msg = "hello"; String IP = "229.201.35.83"; InetAddress address = InetAddress.getByName(IP); DatagramPacket outputPacket = new DatagramPacket(msg.getBytes(), msg.length(), address, 12465); socket.send(outputPacket);
14
UDP Programming // in Java DatagramSocket socket = new DatagramSocket(16789); byte[] data = byte[256]; DatagramPacket inputPacket = new DatagramPacket(data, 256); socket.receive(inputPacket);
15
UDP Summary UDP is a transport-level protocol Which means that UDP deals with message delivery UDP is a connectionless protocol built on top of IP, which is already connectionless Therefore, UDP is essentially direct IP datagram transmission UDP does not provide a reliable service UDP uses ‘best effort’ delivery If messages do not arrive, the application layer (i.e. the application itself) must determine if and when to retransmit the message
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.