All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class AcmeNet.Util.NetAddress

AcmeNet.Util.NetAddress

public class NetAddress
Identifies a "location" that packets can be sent to or from in AcmeNet. A NetAddress consists of an Internet address (roughly, a machine) and a port number.

See Also:
NetworkInterface

Constructor Index

 o NetAddress(InetAddress, int)
 o NetAddress(int)
Creates a NetAddress referring to a port on the local machine.
 o NetAddress(String, int)

Method Index

 o equals(Object)
 o getInetAddress()
 o getPort()
 o hashCode()
 o toString()

Constructors

 o NetAddress
 public NetAddress(InetAddress a,
                   int p)
Parameters:
a - the address of a machine on the Internet
p - a port number on that machine
 o NetAddress
 public NetAddress(String s,
                   int p) throws UnknownHostException
Parameters:
s - the name of a machine on the Internet
p - a port number on that machine
Throws: UnknownHostException
no machine with the requested name was found
 o NetAddress
 public NetAddress(int p) throws UnknownHostException
Creates a NetAddress referring to a port on the local machine.

Parameters:
p - a port number on the local machine
Throws: UnknownHostException
the Internet address of the local machine could not be determined (probably means the machine isn't connected to the Net, or is deeply confused)

Methods

 o getInetAddress
 public InetAddress getInetAddress()
Returns:
s the Internet address portion of this NetAddress
 o getPort
 public int getPort()
Returns:
s the port-number portion of this NetAddress
 o toString
 public String toString()
Returns:
s a printable representation of this NetAddress
 o equals
 public boolean equals(Object o)
Returns:
s true if o is a NetAddress equivalent to this one
 o hashCode
 public int hashCode()

All Packages  Class Hierarchy  This Package  Previous  Next  Index