Networking Properties

There are a few standard system properties used toalter the mechanisms and behavior of the various classes of thejava.net package. Some are checked only once at startup of the VM,and therefore are best set using the -D option of the java command,while others have a more dynamic nature and can also be changed usingtheSystem.setProperty() API.The purpose of this document is to listand detail all of these properties.

If there is no special note, a property value is checked every time it is used.

IPv4 / IPv6

Both of these properties are checked only once, at startup.

Proxies

A proxy server allows indirect connection to network services andis used mainly for security (to get through firewalls) andperformance reasons (proxies often do provide caching mechanisms).

Applications may use theProxySelector.select(URI) methodto determine the proxy that should be used for connecting to a given URI.

The following properties are used to configure the JDK defaultProxySelector implementation. This is the ProxySelector returned byProxySelector.getDefault() when no default ProxySelector was installed byProxySelector.setDefault(ProxySelector)

Misc HTTP URL stream protocol handler properties

All these properties are checked only once at startup.

Address Cache

The java.net package, when doing name resolution, uses an addresscache for both security and performance reasons. Any addressresolution attempt, be it forward (name to IP address) or reverse (IPaddress to name), will have its result cached, whether it wassuccessful or not, so that subsequent identical requests will nothave to access the naming service. These properties allow for sometuning on how the cache is operating.

Since these 3 properties are part of the security policy, they arenot set by either the -D option or theSystem.setProperty() API,instead they are set assecurity properties.

Unix domain sockets

CallingServerSocketChannel.bindwith anull address parameter will bind to anautomatically assigned socket address.For Unix domain sockets, this means a unique path in some predefined system temporary directory.There are a number of system (and networking) properties that affect this behavior.

Unix domain socket addresses are limited in length to approximately 100 bytes (depending on the platform), it is important to ensure that the temporary directory's nametogether with the filename used for the socket (currently a name similar tosocket_1679697142) does not exceed this limit. The following propertiescan be used to control the selection of this directory:

More information about the platform specific behavior can be seen in theconf/net.properties configuration file.

Implicit binding of aSocketChannel

If a client socket is connected to a remote destination without callingbind first,then the socket isimplicitly bound. In this case,Unix domain sockets areunnamed (ie. their path is empty). This behavior is not affected by anysystem or networking properties.

Enhanced exception messages

By default, for security reasons, exception messages do not include potentially sensitivesecurity information such as hostnames or Unix domain socket address paths.The following property can be used to relax this restriction, for debugging and otherpurposes.