Porting the Java Networking Classes


The Java networking classes provide a powerful set of networking services based on sockets. Porting java.net to a target RTOS is straightforward as long as there is a BSD socket library. The java.net portability layer is contained in a set of native methods in src/platform/net.

The two sample implementations are based on platform-provided socket libraries:

Solaris
The Solaris implementation uses the BSD-based socket library described in the Transport Interfaces Programming Guide and socket(3XN).

Windows NT
The Windows NT implementation uses the WinSock 2 library described in WinSock Development Information.

There are two source files in each platform-specific directory:

socket.c
Contains the basic platform-specific native methods for the classes in java.net.

multicast.c
Contains a few extra platform-specific native methods that provide multicast functionality for java.net.PlainDatagramSocketImpl.

If a target RTOS provides a BSD-based socket library, then it should be straightforward to port the native methods in src/platform/net. In most cases, it is easiest to use the Solaris source files as a template for a new port.

Note: The target RTOS must provide the implementation of TCP/IP, DNS and any other related networking protocols. If dialup is desired, the dialer and PPP implementation must be supplied by the target RTOS.