December 1999
Intermediate to advanced
816 pages
20h 27m
English
This chapter provides a quick reference of interfaces and classes in java.net, which provides support for performing networking in Java. There's support for TCP sockets, UDP sockets, and UDP multicast sockets. The class java.net.INetAddress provides methods to obtain IP addresses from host names as well as host names from IP addresses. It also provides the getLocalHost() method to obtain an INetAddress object (which contains the host address and host name) for the local host, like so:
InetAddress thisComputer = InetAddress.getLocalHost();
In addition, java.net provides classes for making connections to a URL—for example, the URLConnection and HttpURLConnection classes. These two classes may be used to communicate from a ...
Read now
Unlock full access