Package org.jcsp.net.tcpip
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 Summary
Fields Modifier and Type Field Description private static int
QUEUE_LENGTH
private java.net.ServerSocket
serverSocket
The socket to accept from.
-
Constructor Summary
Constructors Modifier Constructor Description private
TCPIPLinkServer(java.net.ServerSocket serverSocket, boolean uniqueAddress)
Private constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static LinkServer
create(NodeAddressID addressID)
Create a server on a specified NodeAddressID, and start it.void
run()
Start accepting links and dealing with them.protected boolean
stop()
Stops the LinkServer.-
Methods inherited from class org.jcsp.net.LinkServer
getLinkServerAddressID, getProtocolID
-
-
-
-
Constructor Detail
-
TCPIPLinkServer
private TCPIPLinkServer(java.net.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:
#start(ServerSocket)
-
-
Method Detail
-
run
public void run()
Start accepting links and dealing with them. This method runs forever.
-
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 classLinkServer
- Returns:
true
iff theLinkServer
has stopped.
-
-