## com.bbn.openmap.layer.link
Class LinkServerStarter

    java.lang.Object
      com.bbn.openmap.layer.link.LinkServerStarter

Direct Known Subclasses:
  ShapeServerStarter, TestServerStarter

public class LinkServerStarter
extends java.lang.Object

The LinkServerStarter is the object that listens for Link clients on a specific port. If a Link client contacts it, it uses the startNewServer method to create a LinkServer to serve the client on it's own thread. If you want to create a new type of LinkServer, you should also create a new LinkServerStarter to launch it properly. Generally, the main() and startNewServer() methods are the only thing you would need to modify.

Field Summary
`static int` `DEFAULT_PORT` Default port that the server starter listens to.
`protected int` `serverPort` The port being listened to.

Constructor Summary
`LinkServerStarter()` Starts the LinkServerStarter listening to the default port.
`LinkServerStarter(int port)` Starts the LinkServerStarter listening to the specified port.

Method Summary
`int` `getPort()` Get the port that is being listened to.
`static void` `main(java.lang.String[] argv)` Start up the server.
`void` `run()` The method of the parent server that is listening for clients.
`void` `setPort(int port)` Set the port to listen for a connection request.
`java.lang.Thread` `startNewServer(java.net.Socket sock)` This method gets called to create a new server to handle a new connection.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### DEFAULT_PORT

    public static final int DEFAULT_PORT

  Default port that the server starter listens to.

  See Also:
    Constant Field Values

### serverPort

    protected int serverPort

  The port being listened to.

Constructor Detail

### LinkServerStarter

    public LinkServerStarter()

  Starts the LinkServerStarter listening to the default port.

### LinkServerStarter

    public LinkServerStarter(int port)

  Starts the LinkServerStarter listening to the specified port.

Method Detail

### setPort

    public void setPort(int port)

  Set the port to listen for a connection request.

### getPort

    public int getPort()

  Get the port that is being listened to.

### run

    public void run()

  The method of the parent server that is listening for clients. When a contact is made, a child thread is spawned off to handle the client.

### startNewServer

    public java.lang.Thread startNewServer(java.net.Socket sock)

  This method gets called to create a new server to handle a new connection. Thread.start() will get called on the returned thread. This method should always get overridden.

  Parameters:
    `sock` - the socket connection
  Returns:
    a thread that will get started
  See Also:
    `Thread.start()`

### main

    public static void main(java.lang.String[] argv)

  Start up the server. This is the method to change if you want to customize how the LinkServer will handle clients - port, arguments, etc.

Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details