CPSC 441 TUTORIAL – FEB 13, 2012 TA: RUITNG ZHOU UDP REVIEW.

Slides:



Advertisements
Similar presentations
Layer 3 of the TCP/IP protocol stack. Transport layer.
Advertisements

Umut Girit  One of the core members of the Internet Protocol Suite, the set of network protocols used for the Internet. With UDP, computer.
CCNA – Network Fundamentals
© 2007 Cisco Systems, Inc. All rights reserved.Cisco Public ITE PC v4.0 Chapter 1 1 OSI Transport Layer Network Fundamentals – Chapter 4.
Intermediate TCP/IP TCP Operation.
Chapter 7: Transport Layer
UDP - User Datagram Protocol UDP – User Datagram Protocol Author : Nir Shafrir Reference The TCP/IP Guide - ( Version Version.
Windows Sockets Purpose Windows Sockets 2 (Winsock) enables programmers to create advanced internet, intranet, and other network-capable applications to.
Tutorial 8 Socket Programming
TDC561 Network Programming Camelia Zlatea, PhD Week 2 – part II: Socket Application Programming Interface.
Gursharan Singh Tatla Transport Layer 16-May
Process-to-Process Delivery:
TRANSPORT LAYER T.Najah Al-Subaie Kingdom of Saudi Arabia Prince Norah bint Abdul Rahman University College of Computer Since and Information System NET331.
Socket Programming. Introduction Sockets are a protocol independent method of creating a connection between processes. Sockets can be either – Connection.
University of Calgary – CPSC 441.  UDP stands for User Datagram Protocol.  A protocol for the Transport Layer in the protocol Stack.  Alternative to.
Hyung-Min Lee©Networking Lab., 2001 Chapter 11 User Datagram Protocol (UDP)
Jaringan Komputer Dasar OSI Transport Layer Aurelio Rahmadian.
TCP/IP: Basics1 User Datagram Protocol (UDP) Another protocol at transport layer is UDP. It is Connectionless protocol i.e. no need to establish & terminate.
Transport Layer Layer #4 (OSI-RM). Transport Layer Main function of OSI Transport layer: Accept data from the Application layer and prepare it for addressing.
TCOM 509 – Internet Protocols (TCP/IP) Lecture 04_a Transport Protocols - UDP Instructor: Dr. Li-Chuan Chen Date: 09/22/2003 Based in part upon slides.
University of the Western Cape Chapter 12: The Transport Layer.
Microsoft Windows Server 2003 TCP/IP Protocols and Services Technical Reference Slide: 1 Lesson 11 User Datagram Protocol (UDP)
 Wind River Systems, Inc Chapter - 13 Network Programming.
1 Transport Protocols Relates to Lab 5. An overview of the transport protocols of the TCP/IP protocol suite. Also, a short discussion of UDP.
CCNA 1 v3.0 Module 11 TCP/IP Transport and Application Layers.
McGraw-Hill©The McGraw-Hill Companies, Inc., 2000 Transmission Control Protocol (TCP)
Chapter 2 Applications and Layered Architectures Sockets.
Networking Tutorial Special Interest Group for Software Engineering Luke Rajlich.
CSCE 515: Computer Network Programming UDP Socket Wenyuan Xu Department of Computer Science and Engineering.
Institute of Technology Sligo - Dept of Computing Chapter 12 The Transport Layer.
1 Transport Protocols Relates to Lab 5. An overview of the transport protocols of the TCP/IP protocol suite. Also, a short discussion of UDP.
Programming with UDP – II Covered Subjects: Creating UDP sockets Client Server Sending data Receiving data Connected mode.
S OCKET P ROGRAMMING IN C Professor: Dr. Shu-Ching Chen TA: HsinYu Ha.
S OCKET P ROGRAMMING IN C Professor: Dr. Shu-Ching Chen TA: Hsin-Yu Ha.
CSCI 330 UNIX and Network Programming Unit XIV: User Datagram Protocol.
1 Kyung Hee University Chapter 11 User Datagram Protocol.
1 User Datagram Protocol. 2 Transport Protocols Provide logical communication between application processes running on different hosts Run on end hosts.
Data Communications and Networks Chapter 6 – IP, UDP and TCP ICT-BVF8.1- Data Communications and Network Trainer: Dr. Abbes Sebihi.
Bjorn Landfeldt, The University of Sydney 1 ELEC 3504 UDP.
Lecture 3 TCP and UDP Sockets CPE 401 / 601 Computer Network Systems slides are modified from Dave Hollinger.
Cisco I Introduction to Networks Semester 1 Chapter 7 JEOPADY.
2: Transport Layer 11 Transport Layer 1. 2: Transport Layer 12 Part 2: Transport Layer Chapter goals: r understand principles behind transport layer services:
1 Socket Interface. 2 Client-Server Architecture The client is the one who speaks first Typical client-server situations  Client and server on the same.
Process-to-Process Delivery:
Socket Programming(1/2). Outline  1. Introduction to Network Programming  2. Network Architecture – Client/Server Model  3. TCP Socket Programming.
CSEN 404 Transport Layer I Amr El Mougy Lamia Al Badrawy.
Two Transport Protocols Available Transmission Control Protocol (TCP) User Datagram Protocol (UDP) Provides unreliable transfer Requires minimal – Overhead.
1 Socket Interface. 2 Basic Sockets API Review Socket Library TCPUDP IP EthernetPPP ARP DHCP, Mail, WWW, TELNET, FTP... Network cardCom Layer 4 / Transport.
SOCKET PROGRAMMING Presented By : Divya Sharma.
Chapter 11 User Datagram Protocol
The Transport Layer Implementation Services Functions Protocols
Transport Protocols Relates to Lab 5. An overview of the transport protocols of the TCP/IP protocol suite. Also, a short discussion of UDP.
Transport Layer.
Process-to-Process Delivery, TCP and UDP protocols
Socket Programming in C
Chapter 14 User Datagram Protocol (UDP)
Transport Protocols Relates to Lab 5. An overview of the transport protocols of the TCP/IP protocol suite. Also, a short discussion of UDP.
Transport Protocols Relates to Lab 5. An overview of the transport protocols of the TCP/IP protocol suite. Also, a short discussion of UDP.
UDP Sockets Programming
Process-to-Process Delivery:
Socket Programming in C
Transport Protocols An overview of the transport protocols of the TCP/IP protocol suite. Also, a short discussion of UDP.
TCP and UDP Layer 3 of the TCP/IP protocol stack. Transport layer
CPEG514 Advanced Computer Networkst
Chapter 06. UDP Server/Client.
CS4470 Computer Networking Protocols
Process-to-Process Delivery: UDP, TCP
Transport Protocols Relates to Lab 5. An overview of the transport protocols of the TCP/IP protocol suite. Also, a short discussion of UDP.
Transport Layer 9/22/2019.
Presentation transcript:

CPSC 441 TUTORIAL – FEB 13, 2012 TA: RUITNG ZHOU UDP REVIEW

WHAT IS UDP? UDP stands for User Datagram Protocol. It is a simple protocol in Transport Layer of the OSI model. UDP was defined in RFC 768. Alternative to the Transmission Control Protocol (TCP) and, together with IP, is also referred to as UDP/IP Programs on networked computers can send short messages sometimes known as datagram (using Datagram Sockets) to one another. 2

FEATURES OF UDP UDP is a minimal message-oriented Transport Layer protocol. Unreliable Datagram Protocol : UDP provides no guarantees to the upper layer protocol for message delivery the UDP protocol layer retains no state of UDP messages once sent UDP provides application multiplexing (via port numbers) Provide integrity verification (via checksum) of the header and payload. 3

UDP HEADER The UDP header consists of 4 fields, each of which is 2 bytes. The use of two of those is optional in IPv4 (pink background in table). In IPv6 only the source port is optional. Source port number Identifies the sender's port, should be assumed to be the port to reply to if needed. If not used, then it should be zero. If the source host is the client  an ephemeral port number. If the source host is the server  a well-known port number 4

UDP HEADER Destination port number Identifies the receiver's port and is required if the client is the destination host  an ephemeral port number. if the destination host is the server  a well-known port number Length Specifies the length in bytes of the entire datagram: header and data The minimum length is 8 bytes = the length of the header. The field size sets a theoretical limit of 65,535 bytes ( 8 byte header + 65,527 bytes of data ) for a UDP datagram 5

UDP HEADER Checksum The checksum field is used for error-checking of the header and data. If no checksum is generated by the transmitter, the field uses the value all-zeros. This field is not optional for IPv6. UDP uses Pseudo header to define the checksum. It is calculated over the combination of pseudo header and UDP message. The pseudo header contains: the IP Source Address field, the IP Destination Address field, the IP Protocol field and the UDP Length field. 6

BASIC OPERATIONS FOR TRANSMISSION USING UDP 1. Higher-Layer Data Transfer : An application sends a message to the UDP software. 2. UDP Message Encapsulation : The higher-layer message is encapsulated into the Data field of a UDP message. The headers of the UDP message are filled in, including : the Source Port of the application that sent the data to UDP the Destination Port of the intended recipient. The checksum value is also calculated. 3. Transfer Message to IP : The UDP message is passed to IP for transmission. 7

DIFFERENCE BETWEEN TCP AND UDP One interesting video about TCP vs UDP: TCP is a connection-oriented protocol; a connection can be made from client to server, and from then on any data can be sent along that connection. UDP is a simpler message-based connectionless protocol. The UDP messages (packets) that cross the network is in the independent units. 8

DIFFERENCE BETWEEN TCP AND UDP 9

WHY STILL USE UDP? TCP header is much larger than the UDP header. That header is being applied to every segments, and adds up! UDP advantages over TCP is that its header is much smaller than TCP’s and it has much simpler processing steps. UDP is widely used and recommended for: When Speed Is More Important. An application values timely delivery over reliable delivery Places where data exchanges are short and the order of reception of datagram does not matter Acknowledgement of delivery is not needed Applications that require multicast or broadcast transmissions, since these are not supported by TCP. 10

SOME POPULAR EXAMPLES WHERE UDP IS USED Multimedia applications like streaming video, VOIP In multicast environment If an application needs to multicast or broadcast data, it must use UDP, because TCP is only supported for unicast communication between two devices. Domain Name System (DNS) Simple network management protocol (SNMP) Dynamic Host Configuration Protocol (DHCP) Routing Information Protocol (RIP) 11

UDP SOCKET PROGRAMMING Interaction between the UDP server and UDP client A UDP server does not have to listen for and accept client connections A UDP client does not have to connect to a server. 12

UDP SERVER SOCKET Open a datagram socket with socket. 2. Name the socket with the bind function, using a SOCKADDR_IN structure for the address parameter. 3. Exchange data with a client using the sendto and recvfrom functions 4. Close the connection with the closesocket function

SOCKET AND BIND FUNCTION SOCKET FUNCTION int socket (address format, type, int protocol); int sock; sock = socket( AF_INET, SOCK_DGRAM, IPPROTO_UDP ) BIND FUNCTION int bind( SOCKET s, const struct sockaddr FAR* name, int namelen); struct sockaddr_in myaddr; myaddr.sin_family = AF_INET; myaddr.sin_port = htons( 1234 ); myaddr.sin_addr = htonl( INADDR_ANY ); bind(mysock, &myaddr, sizeof(myaddr)); If no error occurs, this function returns zero. If an error occurs, it returns SOCKET_ERROR. 14

SENDING DATA SENDTO FUNCTION: int sendto( SOCKET s, const char FAR* buf, int len, int flags, const struct sockaddr FAR* to, int tolen ); S: Descriptor identifying a possibly connected socket. Buf: Buffer containing the data to be transmitted. Len: Length of the data in the buf parameter. Flags: Indicator specifying the way in which the call is made. To: Optional pointer to the address of the target socket. Tolen: Size of the address in the to parameter. Return value : If no error occurs, this function returns the total number of bytes sent, if an error occurs, a value of SOCKET_ERROR is returned. 15

RECEIVING DATA RECEFROM FUNCTION: int recvfrom( SOCKET s, char FAR* buf, int len, int flags, struct sockaddr FAR* from, int FAR* fromlen ); S: Descriptor identifying a bound socket. Buf: Buffer for the incoming data. Len: Length of the buf parameter. Flags: Indicator specifying the way in which the call is made. From: Optional pointer to a buffer that will hold the source address on return. Fromlen: Optional pointer to the size of the from buffer. Return value : If no error occurs, this function returns the number of bytes received. If the connection has been gracefully closed, the return value is zero. If an error occurs, a value of SOCKET_ERROR is returned. 16

CLOSE More about sendto and recefrom function: Server application calls recvfrom to prepare to receive data from a client. The sendto function is used on a connectionless socket to send a datagram to a specific peer socket identified by the to parameter. Successfully completing a sendto function call does not confirm data was successfully delivered. CLOSE FUNCTION int closesocket( SOCKET s ); 17

UDP CLIENT SOCKET 1. Open a socket with the socket function. 2. Exchange data with server using sendto and recvfrom. 3. Close the connection with the closesocket function. 18

EXAMPLE One simple example: ping/pong UDP client and server 19

REFERENCE m_Protocol.pdf m_Protocol.pdf