UDP Client Server Program
UDP Client Server Program
Shweta Waghmare
TIMSCDR
Topics
❑ Create nodes
Application: a packet generator and consumer which can run on a Node and
talk to a set of network stacks
● DatagramSockets can be used to both send and receive packets over the
Internet.
Examples
● UDP is preferred over TCP is the live coverage of TV channels. In this aspect, we want to
transmit as many frames to live audience as possible not worrying about the loss of one or
two frames. TCP being a reliable protocol add its own overhead while transmission.
● Another example where UDP is preferred is online multiplayer gaming. In games like
counter-strike or call of duty, it is not necessary to relay all the information but the most
important ones.
● It should also be noted that most of the applications in real life uses careful blend of both
UDP and TCP; transmitting the critical data over TCP and rest of the data via UDP.
Creation of DatagramSocket:-
First, a datagramSocket object is created to carry the packet to the destination and to receive it
whenever the server sends any data. To create a datagramSocket following constructors can be used:
https://www.nsnam.org/docs/release/3.19/doxygen/udp-client-server_8cc_source.html