Package naga
Interface NIOAbstractSocket
-
- All Known Subinterfaces:
NIOServerSocket,NIOServerSocketSSL,NIOSocket,NIOSocketSSL
public interface NIOAbstractSocketAn interface describing methods common to both NIOSocket and NIOServerSocket.- Author:
- Christoffer Lerno
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclose()Closes this socket (the actual disconnect will occur on the NIOService thread)java.net.InetSocketAddressgetAddress()Returns the InetSocketAddress for this socket.java.lang.StringgetIp()Reports the IP used by this socket.intgetPort()Returns the port in use by this socket.java.lang.ObjectgetTag()Returns the tag for this socket.booleanisOpen()Returns the current state of this socket.voidsetTag(java.lang.Object tag)Returns the tag for this socket.
-
-
-
Method Detail
-
close
void close()
Closes this socket (the actual disconnect will occur on the NIOService thread)This method is thread-safe.
-
getAddress
java.net.InetSocketAddress getAddress()
Returns the InetSocketAddress for this socket.This method is thread-safe.
- Returns:
- the InetSocketAddress this socket connects to.
-
isOpen
boolean isOpen()
Returns the current state of this socket.This method is thread-safe.
- Returns:
- true if the connection is socket is open, false if closed.
-
getIp
java.lang.String getIp()
Reports the IP used by this socket.This method is thread-safe.
- Returns:
- the IP of this socket.
-
getPort
int getPort()
Returns the port in use by this socket.This method is thread-safe.
- Returns:
- the port of this socket.
-
getTag
java.lang.Object getTag()
Returns the tag for this socket.- Returns:
- the tag or null if no tag has been set.
-
setTag
void setTag(java.lang.Object tag)
Returns the tag for this socket. A tag is an object that you can associate with the socket and retrieve later.- Parameters:
tag- the new tag for this socket.
-
-