Socket programming for UDP

Java supports both TCP and UDP through the Socket and DatagramSocket classes from the java.net package. Other components of this package foster communication between processes over the network using an IP address. A new socket object can be instantiated through the socket name or InetAddress and the port on which the process is running on the host.

As seen earlier, TCP is considered consistent in terms of receiving data in packets the same order as they are sent and with guaranteed delivery. If the next packet is not received in a defined period of time, then the receiver requests it again. The receiver keeps waiting until the packet is received and doesn't move further. In the UDP protocol, it's the other way round: ...

Get Distributed Computing in Java 9 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.