Class TCPIPLinkServer

java.lang.Object
org.jcsp.net.LinkServer
org.jcsp.net.tcpip.TCPIPLinkServer
All Implemented Interfaces:
CSProcess

class TCPIPLinkServer extends LinkServer implements CSProcess
A process to accept links to a ServerSocket, create appropriate TCPIPLink objects, and register them with the LinkManager.

This is a package-private implementation class.

  • Field Details

    • serverSocket

      private final ServerSocket serverSocket
      The socket to accept from.
    • QUEUE_LENGTH

      private static int QUEUE_LENGTH
  • Constructor Details

    • TCPIPLinkServer

      private TCPIPLinkServer(ServerSocket serverSocket, boolean uniqueAddress)
      Private constructor. To make life easier for you, you don't have to call this. Just use the static start() method in this class and a process will be created and executed for you.
      Parameters:
      socket - The ServerSocket to accept from
      See Also:
      • invalid reference
        #start(ServerSocket)
  • Method Details

    • run

      public void run()
      Start accepting links and dealing with them. This method runs forever.
      Specified by:
      run in interface CSProcess
    • create

      protected static LinkServer create(NodeAddressID addressID)
      Create a server on a specified NodeAddressID, and start it. The server is spawned off in parallel, so this call returns immediately. This NEEDS to be overridden.
      Parameters:
      addressID - The NodeAddressID to accept from
    • stop

      protected boolean stop()
      Stops the LinkServer. This NEEDS to be overridden.
      Overrides:
      stop in class LinkServer
      Returns:
      true iff the LinkServer has stopped.