Class TCPIPNodeAddress
java.lang.Object
org.jcsp.net2.NodeAddress
org.jcsp.net2.tcpip.TCPIPNodeAddress
- All Implemented Interfaces:
Serializable, Comparable
A concrete implementation of a NodeAddress that is designed for TCP/IP connections.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate StringThe IP address part of the addressprivate intThe port part of the addressprivate static final longThe SUID for this classFields inherited from class NodeAddress
address, protocol -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new TCPIPNodeAddressTCPIPNodeAddress(int portNumber) Creates a new TCPIPNodeAddress using the local IP address and a given port number.TCPIPNodeAddress(String ipAddress, int portNumber) Creates a new TCPIPNodeAddress from an IP address and port -
Method Summary
Modifier and TypeMethodDescriptionprotected LinkCreates a new TCPIPLink connected to a Node with this addressprotected LinkServerCreates a new TCPIPLinkServer listening on this addressfinal StringGets the IP address part of the addressfinal intgetPort()Gets the port number part of this addressprotected ProtocolIDReturns the TCPIPProtocolID(package private) voidsetAddress(String str) Sets the address String.(package private) voidsetIpAddress(String ipAddr) Sets the IP address part of the NodeAddress.(package private) voidsetPort(int portNumber) Sets the port part of the address.Methods inherited from class NodeAddress
compareTo, equals, getAddress, getProtocol, hashCode, installProtocol, parse, toString
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDThe SUID for this class- See Also:
-
ip
The IP address part of the address -
port
private int portThe port part of the address
-
-
Constructor Details
-
TCPIPNodeAddress
Creates a new TCPIPNodeAddress from an IP address and port- Parameters:
ipAddress- The IP address part of the NodeAddressportNumber- The port number part of the NodeAddress
-
TCPIPNodeAddress
public TCPIPNodeAddress(int portNumber) Creates a new TCPIPNodeAddress using the local IP address and a given port number. Allows a- Parameters:
portNumber- The port number to use
-
TCPIPNodeAddress
public TCPIPNodeAddress()Creates a new TCPIPNodeAddress
-
-
Method Details
-
getPort
public final int getPort()Gets the port number part of this address- Returns:
- The port number part of the address
-
setPort
void setPort(int portNumber) Sets the port part of the address. Used internally in JCSP- Parameters:
portNumber- The port number to use
-
getIpAddress
Gets the IP address part of the address- Returns:
- The IP Address part of the address
-
setIpAddress
Sets the IP address part of the NodeAddress. Used internally in JCSP- Parameters:
ipAddr- The IP address to use
-
setAddress
Sets the address String. Used internally within JCSP- Parameters:
str- The String to set as the address
-
createLink
Creates a new TCPIPLink connected to a Node with this address- Specified by:
createLinkin classNodeAddress- Returns:
- A new TCPIPLink connected to this address
- Throws:
JCSPNetworkException- Thrown if something goes wrong during the creation of the Link
-
createLinkServer
Creates a new TCPIPLinkServer listening on this address- Specified by:
createLinkServerin classNodeAddress- Returns:
- A new TCPIPLinkServer listening on this address
- Throws:
JCSPNetworkException- Thrown if something goes wrong during the creation of the LinkServer
-
getProtocolID
Returns the TCPIPProtocolID- Specified by:
getProtocolIDin classNodeAddress- Returns:
- TCPIPProtocolID
-