O'Reilly logo

Java™ Network Programming and Distributed Computing by Michael Reilly, David Reilly

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

5.7. Building a UDP Client/Server

The previous example illustrates the technical details of how an individual packet may be sent and received. But applications need a series of packets, not just one. The next example shows how to build a UDP server, a long-running system that is capable of serving many requests during its lifetime. The type of service that is provided is an echo service, which echoes back the contents of a packet. The echo service runs on a well-known port, port 7, and if it is known that a system has an echo server installed, the server may be accessed by clients to see if a system is up and running (similar to the ping application). The example below demonstrates how to write an echo client that will send packets to the server ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required