fr.dyade.aaa.common.net
Class SocketAddress

java.lang.Object
  extended by fr.dyade.aaa.common.net.SocketAddress

public class SocketAddress
extends java.lang.Object

This class implements an IP Socket Address (IP address + port number)


Field Summary
private  java.net.InetAddress addr
          The IP address of the Socket Address
private  java.lang.String hostname
          The hostname of the Socket Address
private  int port
          The port number of the Socket Address
 
Constructor Summary
SocketAddress(java.lang.String hostname, int port)
          Creates a socket address from a hostname and a port number.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Compares this object against the specified object.
 java.net.InetAddress getAddress()
          Gets the InetAddress.
 java.lang.String getHostname()
          Gets the hostname.
 int getPort()
          Gets the port number.
 int hashCode()
           
 java.net.InetAddress resetAddr()
          Resolves the IP address for this hostname, don't use an eventually caching address.
 java.lang.String toString()
          Constructs a string representation of this InetSocketAddress.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

hostname

private java.lang.String hostname
The hostname of the Socket Address


addr

private java.net.InetAddress addr
The IP address of the Socket Address


port

private int port
The port number of the Socket Address

Constructor Detail

SocketAddress

public SocketAddress(java.lang.String hostname,
                     int port)
Creates a socket address from a hostname and a port number.

Parameters:
hostname - the Host name
port - The port number
Method Detail

resetAddr

public java.net.InetAddress resetAddr()
Resolves the IP address for this hostname, don't use an eventually caching address.

Returns:
the resolved IP address.

getPort

public int getPort()
Gets the port number.

Returns:
the port number.

getHostname

public java.lang.String getHostname()
Gets the hostname.

Returns:
the hostname part of the address.

getAddress

public java.net.InetAddress getAddress()
Gets the InetAddress.

Returns:
the InetAdress or null if it is unresolved.

equals

public boolean equals(java.lang.Object obj)
Compares this object against the specified object.

Overrides:
equals in class java.lang.Object
Parameters:
obj - the object to compare against.
Returns:
true if the objects are the same; false otherwise.

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Constructs a string representation of this InetSocketAddress.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of this object.


Copyright © 2010 ScalAgent D.T.. All Rights Reserved.