Socket programming and networking examples in Java.
UDP & TCP work different to some extent.When data is being sent through TCP, first of all a connection is created. Once TCP connection gets established, it is guaranteed by TCP that data would be reaching the other end for sure, or error will be occurred.
Only datagram i.e. packets of data is being sent by UDP to the network’s IP address. There is no guarantee that data reaches. Also, no guarantee is there regarding order in which these packets of data would be arrived at receiver.