Package fr.dyade.aaa.common.net
Class SocketAddress
- java.lang.Object
-
- fr.dyade.aaa.common.net.SocketAddress
-
public class SocketAddress extends Object
This class implements an IP Socket Address (IP address + port number)
-
-
Field Summary
Fields Modifier and Type Field Description private InetAddressaddrThe IP address of the Socket Addressprivate StringhostnameThe hostname of the Socket Addressprivate intportThe port number of the Socket Address
-
Constructor Summary
Constructors Constructor Description SocketAddress(String hostname, int port)Creates a socket address from a hostname and a port number.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)Compares this object against the specified object.InetAddressgetAddress()Gets theInetAddress.StringgetHostname()Gets thehostname.intgetPort()Gets the port number.inthashCode()InetAddressresetAddr()Resolves the IP address for this hostname, don't use an eventually caching address.StringtoString()Constructs a string representation of this InetSocketAddress.
-
-
-
Field Detail
-
hostname
private String hostname
The hostname of the Socket Address
-
addr
private 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(String hostname, int port)
Creates a socket address from a hostname and a port number.- Parameters:
hostname- the Host nameport- The port number
-
-
Method Detail
-
resetAddr
public 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 String getHostname()
Gets thehostname.- Returns:
- the hostname part of the address.
-
getAddress
public InetAddress getAddress()
Gets theInetAddress.- Returns:
- the InetAdress or
nullif it is unresolved.
-
equals
public boolean equals(Object obj)
Compares this object against the specified object.
-
-