org.jcsp.net2.tcpip
Class TCPIPNodeAddress

java.lang.Object
  extended by org.jcsp.net2.NodeAddress
      extended by org.jcsp.net2.tcpip.TCPIPNodeAddress
All Implemented Interfaces:
Serializable, Comparable

public final class TCPIPNodeAddress
extends NodeAddress

A concrete implementation of a NodeAddress that is designed for TCP/IP connections.

Author:
Kevin Chalmers
See Also:
NodeAddress, Serialized Form

Field Summary
 
Fields inherited from class org.jcsp.net2.NodeAddress
address, protocol
 
Constructor Summary
TCPIPNodeAddress()
          Creates a new TCPIPNodeAddress
TCPIPNodeAddress(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
protected  Link createLink()
          Creates a new TCPIPLink connected to a Node with this address
protected  LinkServer createLinkServer()
          Creates a new TCPIPLinkServer listening on this address
 String getIpAddress()
          Gets the IP address part of the address
 int getPort()
          Gets the port number part of this address
protected  ProtocolID getProtocolID()
          Returns the TCPIPProtocolID
 
Methods inherited from class org.jcsp.net2.NodeAddress
compareTo, equals, getAddress, getProtocol, hashCode, installProtocol, parse, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TCPIPNodeAddress

public TCPIPNodeAddress(String ipAddress,
                        int portNumber)
Creates a new TCPIPNodeAddress from an IP address and port

Parameters:
ipAddress - The IP address part of the NodeAddress
portNumber - 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

getIpAddress

public final String getIpAddress()
Gets the IP address part of the address

Returns:
The IP Address part of the address

createLink

protected Link createLink()
                   throws JCSPNetworkException
Creates a new TCPIPLink connected to a Node with this address

Specified by:
createLink in class NodeAddress
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 class NodeAddress
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 class NodeAddress
Returns:
TCPIPProtocolID


Copyright © 1996-2012. All Rights Reserved.