UDP. User Datagram Protocol (UDP)  Unreliable and unordered datagram service  Adds multiplexing  No flow control  Endpoints identified by ports 

Slides:



Advertisements
Similar presentations
Transport Layer3-1 Transport Overview and UDP. Transport Layer3-2 Goals r Understand transport services m Multiplexing and Demultiplexing m Reliable data.
Advertisements

IP Forwarding Relates to Lab 3.
Taekyung Kim 0x410 ~ 0x International Standards Organization (ISO) is a multinational body dedicated to worldwide agreement on international.
Linux network troubleshooting If your network connection is not working..
Socket Programming.
Introduction to Transport Layer. Transport Layer: Motivation A B R1 R2 r Recall that NL is responsible for forwarding a packet from one HOST to another.
Network Management And Debugging
TCP/IP Protocol Suite 1 Chapter 11 Upon completion you will be able to: User Datagram Protocol Be able to explain process-to-process communication Know.
Chapter 3 Review of Protocols And Packet Formats
TCP/IP Protocol Suite 1 Chapter 6 Upon completion you will be able to: Delivery, Forwarding, and Routing of IP Packets Understand the different types of.
1 IP Forwarding Relates to Lab 3. Covers the principles of end-to-end datagram delivery in IP networks.
TCP/IP Protocol Suite 1 Chapter 6 Upon completion you will be able to: Delivery, Forwarding, and Routing of IP Packets Understand the different types of.
Lecture 8 Modeling & Simulation of Communication Networks.
IST 228\Ch3\IP Addressing1 TCP/IP and DoD Model (TCP/IP Model)
Support Protocols and Technologies. Topics Filling in the gaps we need to make for IP forwarding work in practice – Getting IP addresses (DHCP) – Mapping.
TCP/IP Protocol Suite 1 Chapter 6 Upon completion you will be able to: Delivery, Forwarding, and Routing of IP Packets Understand the different types of.
Module 10. Internet Protocol (IP) is the routed protocol of the Internet. IP addressing enables packets to be routed from source to destination using.
HALP! Something is in my tubes! Part I by Jason Testart, IST.
University of Calgary – CPSC 441.  UDP stands for User Datagram Protocol.  A protocol for the Transport Layer in the protocol Stack.  Alternative to.
1 IP: putting it all together Part 2 G53ACC Chris Greenhalgh.
PA3: Router Junxian (Jim) Huang EECS 489 W11 /
1 IP Forwarding Relates to Lab 3. Covers the principles of end-to-end datagram delivery in IP networks.
Hyung-Min Lee©Networking Lab., 2001 Chapter 11 User Datagram Protocol (UDP)
Operating Systems Lesson 10. Networking Communications protocol is the set of standard rules for ◦ Data representation ◦ Signaling ◦ Authentication ◦
TCP/IP Essentials A Lab-Based Approach Shivendra Panwar, Shiwen Mao Jeong-dong Ryoo, and Yihan Li Chapter 5 UDP and Its Applications.
TCP/IP Illustracted Vol1. 제목 : IP Routing ( 수 ) 한 민 규
IP Forwarding.
1 IP: putting it all together Part 1 G53ACC Chris Greenhalgh.
Internet Ethernet Token Ring Video High Speed Router Host A: Client browser: REQUEST:http//mango.ee.nogradesu.edu/c461.
TCP/IP TCP/IP LAYERED PROTOCOL TCP/IP'S APPLICATION LAYER TRANSPORT LAYER NETWORK LAYER NETWORK ACCESS LAYER (DATA LINK LAYER)
Microsoft Windows Server 2003 TCP/IP Protocols and Services Technical Reference Slide: 1 Lesson 11 User Datagram Protocol (UDP)
NATs and UDP Victor Norman CS322 Spring NAPT Suppose we have a router doing NAT: half is the “public side”, IP address ; other half is.
Polytechnic University1 The internetworking solution of the Internet Prof. Malathi Veeraraghavan Elec. & Comp. Engg. Dept/CATT Polytechnic University
ECE 526 – Network Processing Systems Design Networking: protocols and packet format Chapter 3: D. E. Comer Fall 2008.
Delivery, Forwarding, and Routing of IP Packets
Network Programming Eddie Aronovich mail:
1 CS 4396 Computer Networks Lab TCP/IP Networking An Example.
1 UDP : User Datagram Protocol Computer Network System Sirak Kaewjamnong.
CSE 6590 Department of Computer Science & Engineering York University 111/9/ :26 AM.
CPSC 441 TUTORIAL – FEB 13, 2012 TA: RUITNG ZHOU UDP REVIEW.
1 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Dynamic Host Configuration Protocol (DHCP)
CS 6401 Introduction to Computer Networks 09/21/2010 Outline - UNIX sockets - A simple client-server program - Project 1 - LAN bridges and learning.
TCP/IP Illustracted Vol1. 제목 : IP Routing ( 수 ) 한 민 규
Linux Operations and Administration Chapter Eight Network Communications.
Slide #1 CIT 380: Securing Computer Systems TCP/IP.
Review: – Why layer architecture? – peer entities – Protocol and service interface – Connection-oriented/connectionless service – Reliable/unreliable service.
Computer Communication: An example What happens when I click on
1 Transport Layer: Basics Outline Intro to transport UDP Congestion control basics.
UDP : User Datagram Protocol 백 일 우
1 Kyung Hee University Chapter 11 User Datagram Protocol.
1 COMP 431 Internet Services & Protocols The IP Internet Protocol Jasleen Kaur April 21, 2016.
Ch. 23, 25 Q and A (NAT and UDP) Victor Norman IS333 Spring 2015.
Process-to-Process Delivery:
SOCKET PROGRAMMING Presented By : Divya Sharma.
Behrouz A. Forouzan TCP/IP Protocol Suite, 3rd Ed.
Linux network troubleshooting
Chapter 11 User Datagram Protocol
Transport Protocols Relates to Lab 5. An overview of the transport protocols of the TCP/IP protocol suite. Also, a short discussion of UDP.
MAC Addresses and ARP 32-bit IP address:
ARP: Address Resolution Protocol
Byungchul Park ICMP & ICMPv DPNM Lab. Byungchul Park
Net 323: NETWORK Protocols
Subject Name: Computer Communication Networks Subject Code: 10EC71
Chapter 6 The Data Link layer
Wide Area Networks and Internet CT1403
Delivery, Forwarding, and Routing of IP Packets
TCP/IP Protocol Suite: Review
CPEG514 Advanced Computer Networkst
Synthesis A day in the life of a web request
IP Forwarding Relates to Lab 3.
Presentation transcript:

UDP

User Datagram Protocol (UDP)  Unreliable and unordered datagram service  Adds multiplexing  No flow control  Endpoints identified by ports  servers have well-known ports  see /etc/services on Unix  Optional checksum  pseudo header + udp header + data  Header format

Initiating a Session  Client initiates the connection and sends the clients port in the message header  Server port is contained in /etc/services  DNS=53  talk=517  Connectionless  Primary purpose demux (demultiplex)

Demux Process Application process Application process Application process UDP Packets arrive Ports Queues Packets demultiplexed Port 2000 Port 3000 Port 3100

Using it  TCP  s=socket(AF_INET, SOC_STREAM,0)  bind  listen  accept  connect  read/write  UDP  S=socket(AF_INET, SOCK_DGRAM, 0)  bind (receiver)  sendto, recvfrom

Broadcasting with UDP  You have to enable broadcasting on the socket  Set up the address you will be passing to “sendto” to refer to (0xffffffff)  Anyone in the broadcast domain will be able to read the packet.  A broadcast domain will generally be machines on one port of a router

What is a broadcast domain?  Networks are built from hubs (not used much anymore), ethernet switches and routers  Packets from machines on different ports of a hub will collide (A hub is like tying the wires together)  The collision domain for a network built from hubs is all of the ports on the hub  Broadcast packets from machines on different ports of a ethernet switch will be seen on all ports of the switch  The broadcast domain for a network built from switches is all of the ports on the switch

How does a ethernet switch work?  When you try to connect to mail.cs.byu.edu, your ethernet card doesn’t know which ethernet address to put into the destination  So it sends an Address Resolution Protocol (ARP) packet to the broadcast ethernet address asking if anyone knows about mail.cs.byu.edu  Everyone else will ignore it, mail.cs.byu.edu should respond with a packet indicating what his ethernet address is  Your machine then puts this address into the destination field

Ethernet switches  An ethernet switch learns where certain ethernet addresses are by looking at source addresses  It starts by behaving like a hub, and forwards all packets out every port  When it sees a new source ethernet address on a port, it adds that address to a cache of known addresses  When this ethernet address appears in the destination address of a packet, the switch sends it only to the port where this address was seen as a source address

Broadcast Addresses  When you send a packet to the broadcast IP address, the broadcast ethernet address is placed in the destination address for the packet.  Switches forward packets that are sent to the broadcast ethernet address to all of their ports.  Routers ignore these packets, and only forward packets that are sent directly to their address  That is why you have to configure a gateway

Where do I send packets?  Check to see if the destination IP address is in your broadcast domain  Look at the network mask and see if you both resolve to the same network  If the destination is not in the same network, send it to the gateway  If the destination is in the same network, then ARP to find the ethernet address

ARP Tables  You can use /sbin/arp to see current arp table  $ /sbin/arp -a  cs-private-2.cs.byu.edu ( ) at 00:E0:B1:62:C8:2C [ether] on eth0  You can look at your network mask with ifconfig  $ /sbin/ifconfig  eth0 Link encap:Ethernet HWaddr 00:08:74:30:AD:2F  inet addr: Bcast: Mask:  inet6 addr: fe80::208:74ff:fe30:ad2f/64 Scope:Link  UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1  RX packets: errors:0 dropped:0 overruns:0 frame:0  TX packets: errors:0 dropped:0 overruns:0 carrier:0  collisions:0 txqueuelen:100  RX bytes: (1.5 GiB) TX bytes: (2.6 GiB)

Example (router R2) Network MaskNetwork NumberNext Hop R3 ( ) R1 ( ) (R3)Interface R1 ( ) (R1)Interface 1 Dst= Dst= Dst=

Routers? Hubs? Switches H1 H2H3 H4 H5H6 H7 H8H9 H10 H11H12 Hub X X X X Packet from H1 to H2 Packet from H1 to H10 Packet from H4 to broadcast Seen 171,172,173,174

Routers? Hubs? Switches/Bridges H1 H2H3 H4 H5H6 H7 H8H9 H10 H11H12 Switch X X X X Packet from H1 to H2 Packet from H1 to H10 Packet from H4 to broadcast Seen 171 Seen 171,174 Seen 171,172,173,174 Learn from source Ethernet addresses (layer 2)

Routers? Hubs? Switches H1 H2H3 H4 H5H6 H7 H8H9 H10 H11H12 Router X X X X Packet from H1 to H2 Packet from H1 to H10 Packet from H4 to broadcast Seen 171 Seen 171,174 Seen 172 Use routing protocols and static configurations (layer 3)

Routers? Hubs? Switches H1 H2H3 H4 H5H6 H7 H8H9 H10 H11H12 Hub D D 44.fe d5 S S fe d H10= IP , Ethernet 44.fe d5 D D 44.fe d5 S S fe d5.29 D D 44.fe d5 S S fe d5.29 D D 44.fe d5 S S fe d5.29

Routers? Hubs? Switches H1 H2H3 H4 H5H6 H7 H8H9 H10 H11H12 Switch D D 44.fe d5 S S fe d H10= IP , Ethernet 44.fe d5 D D 44.fe d5 S S fe d5.29 Normally uses only Ethernet addresses

Routers? Hubs? Switches H1 H2H3 H4 H5H6 H7 H8H9 H10 H11H12 Router D D ef.c S S fe d H10= IP , Ethernet 44.fe d5 D D 44.fe d5 S S 55.7e.c ef.c e.c Default Gateway

Our Department  We have ethernet switches throughout the labs  We have a router on the edge between us and the university  Broadcast packets will be seen in most of the labs  They wont go outside of the department  Some administrators may block UDP broadcasts, because they fill every network link in the broadcast domain  If you have a really bad bug in your program, you may bring down the network

Perl Code  Sender  use IO::Socket::INET;  $MySocket=new IO::Socket::INET->new( PeerPort=>1234,Proto=>'udp',PeerAddr=>'localhost');  $msg="This is the message";  $MySocket->send($msg);  Receiver  $MySocket=new IO::Socket::INET->new( LocalPort=>1234, Proto=>'udp')  $MySocket->recv($text,128);  print "\nReceived message '", $text,"'\n";

# Client Program use IO::Socket::INET; print ">> Client Program <<"; # Create a new socket $MySocket=new IO::Socket::INET->new(PeerPort=>1234,Proto=>'udp',Broadcast=>1, PeerAddr=>inet_ntoa(INADDR_BROADCAST)); # Send messages $def_msg="Enter message to send to server : "; print "\n",$def_msg; while($msg= ) { chomp $msg; if($msg ne '') { print "\nSending message '",$msg,"'"; if($MySocket->send($msg)) { print "..... ","\n"; print $def_msg; } else { # Send an empty message to server and exit $MySocket->send(''); exit 1; } # Client Program use IO::Socket::INET; print ">> Client Program <<"; # Create a new socket $MySocket=new IO::Socket::INET->new(PeerPort=>1234,Proto=>'udp',Broadcast=>1, PeerAddr=>inet_ntoa(INADDR_BROADCAST)); # Send messages $def_msg="Enter message to send to server : "; print "\n",$def_msg; while($msg= ) { chomp $msg; if($msg ne '') { print "\nSending message '",$msg,"'"; if($MySocket->send($msg)) { print "..... ","\n"; print $def_msg; } else { # Send an empty message to server and exit $MySocket->send(''); exit 1; } # Server Program use IO::Socket::INET; print ">> Server Program <<\n"; # Create a new socket $MySocket=new IO::Socket::INET->new(LocalPort=>1234,Proto=>'udp'); # Keep receiving messages from client $def_msg="\nReceiving message from client.....\n"; while(1) { $MySocket->recv($text,128); if($text ne '') { print "\nReceived message '", $text,"'\n"; } # If client message is empty exit else { print "Cilent has exited!"; exit 1; } # Server Program use IO::Socket::INET; print ">> Server Program <<\n"; # Create a new socket $MySocket=new IO::Socket::INET->new(LocalPort=>1234,Proto=>'udp'); # Keep receiving messages from client $def_msg="\nReceiving message from client.....\n"; while(1) { $MySocket->recv($text,128); if($text ne '') { print "\nReceived message '", $text,"'\n"; } # If client message is empty exit else { print "Cilent has exited!"; exit 1; }

C Code  Create a dgram socket  sock = socket( AF_INET, SOCK_DGRAM, 0 )  Set the broadcast bit  setsockopt(sock, SOL_SOCKET, SO_BROADCAST,(char *) &one, sizeof(one));  Bind to the port you want to receive on  Recvfrom provides sender information in caller  recvfrom( sock, buf, sizeof buf,0, (struct sockaddr *) &caller,&caller_len)  Sendto parameter contains destination in socketname  sendto(socket, buff,sendflags,(struct sockaddr *)&socketname, sizeof socketname );  Can be broadcast address

Local URL Resolution Protocol  Peer-to-Peer web-cache  Bootstrapping & Peer Discovery  UDP broadcast  Content Location  UDP broadcast for content  Content Delivery  Direct Download from single peer