You can use the NetworkServerControl API to shut down the Network
Server from within a Java application. The name of the method that you use
to shutdown the Network Server is
For example, the following command shuts down the Network Server running on the current machine using the default port number (1527):