final class InetSocketAddress extends SocketAddress
Representation of an IP Socket Address (IP address + port number).
It can also be a pair (hostname + port number), in which case an attempt will be made to resolve the hostname. If resolution fails then the address is said to be unresolved but can still be used on some circumstances like connecting through a proxy. However, note that network channels generally do not accept unresolved socket addresses.
This class provides an immutable object used by sockets for binding, connecting, or as returned values.
The wildcard is a special local IP address. It usually means "any" and can only be used for bind operations.
- Alphabetic
- By Inheritance
- InetSocketAddress
- SocketAddress
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- def address: Option[InetAddress]
The socket's address.
The socket's address.
- returns
The address of the socket, or
None
if this socket address is not resolved.
- final def equals(obj: Any): Boolean
- Definition Classes
- SocketAddress → AnyRef → Any
- final def hashCode(): Int
- Definition Classes
- SocketAddress → AnyRef → Any
- def hostName(implicit trace: Trace): UIO[String]
Gets the hostname.
Gets the hostname.
Note: This method may trigger a name service reverse lookup if the address was created with a literal IP address.
- def hostString(implicit trace: Trace): UIO[String]
Returns the hostname, or the String form of the address if it doesn't have a hostname (it was created using a literal).
Returns the hostname, or the String form of the address if it doesn't have a hostname (it was created using a literal).
This has the benefit of not attempting a reverse lookup. This is an effect because the result could change if a reverse lookup is performed, for example by calling
hostName
. - def isUnresolved: Boolean
Checks whether the address has been resolved or not.
- def port: Int
The socket's port number.
- final def toString(): String
- Definition Classes
- SocketAddress → AnyRef → Any