[Chapter 1] 1.4 The java.net Package

#

| Chapter 1 Introduction |

## 1.4 The java.net Package

The `java.net` package contains classes and interfaces that provide a powerful infrastructure for networking in Java. Many of the classes in this package provide support for working with sockets in Java. For example, the `Socket` and `ServerSocket` classes make it possible to implement client and server programs that communicate using a reliable, connection-oriented protocol. The `DatagramSocket`, `DatagramPacket`, and `MulticastSocket` classes, on the other hand, all provide support for communication over a connectionless protocol. The `MulticastSocket` class is new in Java 1.1.

The `URL` and `URLConnection` classes define methods for working with uniform resource locators (URLs). The `URL` class supports basic access to data stored at a URL, while `URLConnection` offers complete control over all aspects of working with a URL.

The `InetAddress` class represents network addresses, so `InetAddress` objects are used by a number of the methods in other classes in `java.net`.

Chapter 8, Networking, offers a short tutorial on using the networking classes provided by the `java.net` package. See Chapter 15, The java.net Package, for complete reference material on all of the classes in this package.

The java.io Package |  | The java.util Package