Package org.jcsp.net2.tcpip
Class TCPIPNodeAddress
- java.lang.Object
-
- org.jcsp.net2.NodeAddress
-
- org.jcsp.net2.tcpip.TCPIPNodeAddress
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable
public final class TCPIPNodeAddress extends NodeAddress
A concrete implementation of a NodeAddress that is designed for TCP/IP connections.- See Also:
NodeAddress
, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
ip
The IP address part of the addressprivate int
port
The port part of the addressprivate static long
serialVersionUID
The SUID for this class-
Fields inherited from class org.jcsp.net2.NodeAddress
address, protocol
-
-
Constructor Summary
Constructors Constructor Description TCPIPNodeAddress()
Creates a new TCPIPNodeAddressTCPIPNodeAddress(int portNumber)
Creates a new TCPIPNodeAddress using the local IP address and a given port number.TCPIPNodeAddress(java.lang.String ipAddress, int portNumber)
Creates a new TCPIPNodeAddress from an IP address and port
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Link
createLink()
Creates a new TCPIPLink connected to a Node with this addressprotected LinkServer
createLinkServer()
Creates a new TCPIPLinkServer listening on this addressjava.lang.String
getIpAddress()
Gets the IP address part of the addressint
getPort()
Gets the port number part of this addressprotected ProtocolID
getProtocolID()
Returns the TCPIPProtocolID(package private) void
setAddress(java.lang.String str)
Sets the address String.(package private) void
setIpAddress(java.lang.String ipAddr)
Sets the IP address part of the NodeAddress.(package private) void
setPort(int portNumber)
Sets the port part of the address.-
Methods inherited from class org.jcsp.net2.NodeAddress
compareTo, equals, getAddress, getProtocol, hashCode, installProtocol, parse, toString
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
The SUID for this class- See Also:
- Constant Field Values
-
ip
private java.lang.String ip
The IP address part of the address
-
port
private int port
The port part of the address
-
-
Constructor Detail
-
TCPIPNodeAddress
public TCPIPNodeAddress(java.lang.String ipAddress, int portNumber)
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 Detail
-
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
public final java.lang.String getIpAddress()
Gets the IP address part of the address- Returns:
- The IP Address part of the address
-
setIpAddress
void setIpAddress(java.lang.String ipAddr)
Sets the IP address part of the NodeAddress. Used internally in JCSP- Parameters:
ipAddr
- The IP address to use
-
setAddress
void setAddress(java.lang.String str)
Sets the address String. Used internally within JCSP- Parameters:
str
- The String to set as the address
-
createLink
protected Link createLink() throws JCSPNetworkException
Creates a new TCPIPLink connected to a Node with this address- Specified by:
createLink
in classNodeAddress
- Returns:
- A new TCPIPLink connected to this address
- Throws:
JCSPNetworkException
- Thrown if something goes wrong during the creation of the Link
-
createLinkServer
protected LinkServer createLinkServer() throws JCSPNetworkException
Creates a new TCPIPLinkServer listening on this address- Specified by:
createLinkServer
in classNodeAddress
- Returns:
- A new TCPIPLinkServer listening on this address
- Throws:
JCSPNetworkException
- Thrown if something goes wrong during the creation of the LinkServer
-
getProtocolID
protected ProtocolID getProtocolID()
Returns the TCPIPProtocolID- Specified by:
getProtocolID
in classNodeAddress
- Returns:
- TCPIPProtocolID
-
-