Package org.jcsp.net.tcpip
Class TCPIPLinkServer
java.lang.Object
org.jcsp.net.LinkServer
org.jcsp.net.tcpip.TCPIPLinkServer
- All Implemented Interfaces:
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
FieldsModifier and TypeFieldDescriptionprivate static int
private final ServerSocket
The socket to accept from. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
TCPIPLinkServer
(ServerSocket serverSocket, boolean uniqueAddress) Private constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected 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
-
Field Details
-
serverSocket
The socket to accept from. -
QUEUE_LENGTH
private static int QUEUE_LENGTH
-
-
Constructor Details
-
TCPIPLinkServer
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 Details
-
run
public void run()Start accepting links and dealing with them. This method runs forever. -
create
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.
-