In this chapter, we will describe and discuss the most popular network protocols – User Datagram Protocol (UDP), Transmission Control Protocol (TCP), HyperText Transfer Protocol (HTTP), and WebSocket – and their support from the Java Class Library (JCL). We will demonstrate how to use these protocols and how to implement client-server communication in Java code. We will also review Uniform Resource Locator (URL)-based communication and the latest Java HTTP Client API.
The following topics will be covered in this chapter:
- Network protocols
- UDP-based communication
- TCP-based communication
- UDP versus TCP protocols
- URL-based communication
- Using the HTTP 2 Client API