Package org.jcsp.net
Class LinkServer
java.lang.Object
org.jcsp.net.LinkServer
- Direct Known Subclasses:
TCPIPLinkServer
An abstract class that must be implemented by communication
protocol implementations.
LinkServer objects are
processes which listen on a certain address for connection
requests. When a request is received, a Link should be spawned in
server mode.-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedLinkServer(ProtocolID protocolID, NodeAddressID linkServerAddressID) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected static LinkServercreate(NodeAddressID addressID) Create a server on a specifiedNodeAddressID, and start it.protected final NodeAddressIDProtected accessor for obtaining theNodeAddressIDon which this server is listening.protected final ProtocolIDGets the protocol that this LinkServer supports.protected booleanstop()Stops the LinkServer.
-
Field Details
-
protocolID
-
linkServerAddressID
-
-
Constructor Details
-
LinkServer
Constructor. A LinkServer must have an associated protocolID.- Parameters:
protocolID- TheProtocolIDfor the protocol that the concrete implementation ofLinkServersupports.linkServerAddressID- theNodeAddressIDfor thisLinkServerto listen on.
-
-
Method Details
-
create
Create a server on a specifiedNodeAddressID, and start it. The server is spawned off in parallel, so this call returns immediately. This needs to be implemented by the concrete implementation of this class. This is not enforced by the compiler due to this being a static method. This NEEDS to be overridden.- Parameters:
addressID- The NodeAddressID to accept from- Returns:
- the instance of
LinkServer.
-
stop
protected boolean stop()Stops the LinkServer. This NEEDS to be overridden.- Returns:
trueiff theLinkServerhas stopped.
-
getProtocolID
Gets the protocol that this LinkServer supports.- Returns:
- the ProtocolID representing this LinkServers protocol.
-
getLinkServerAddressID
Protected accessor for obtaining theNodeAddressIDon which this server is listening.- Returns:
- the
NodeAddressIDon which this server is listening.
-