Package cx.ath.matthew.unix
Class UnixServerSocket
- java.lang.Object
-
- cx.ath.matthew.unix.UnixServerSocket
-
public class UnixServerSocket extends java.lang.ObjectRepresents a listening UNIX Socket.
-
-
Constructor Summary
Constructors Constructor Description UnixServerSocket()Create an un-bound server socket.UnixServerSocket(UnixSocketAddress address)Create a server socket bound to the given address.UnixServerSocket(java.lang.String address)Create a server socket bound to the given address.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description UnixSocketaccept()Accepts a connection on the ServerSocket.voidbind(UnixSocketAddress address)Binds a server socket to the given address.voidbind(java.lang.String address)Binds a server socket to the given address.voidclose()Closes the ServerSocket.UnixSocketAddressgetAddress()Return the address this socket is bound to.booleanisBound()Check the status of the socket.booleanisClosed()Check the status of the socket.
-
-
-
Constructor Detail
-
UnixServerSocket
public UnixServerSocket()
Create an un-bound server socket.
-
UnixServerSocket
public UnixServerSocket(UnixSocketAddress address) throws java.io.IOException
Create a server socket bound to the given address.- Parameters:
address- Path to the socket.- Throws:
java.io.IOException
-
UnixServerSocket
public UnixServerSocket(java.lang.String address) throws java.io.IOExceptionCreate a server socket bound to the given address.- Parameters:
address- Path to the socket.- Throws:
java.io.IOException
-
-
Method Detail
-
accept
public UnixSocket accept() throws java.io.IOException
Accepts a connection on the ServerSocket.- Returns:
- A UnixSocket connected to the accepted connection.
- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOExceptionCloses the ServerSocket.- Throws:
java.io.IOException
-
bind
public void bind(UnixSocketAddress address) throws java.io.IOException
Binds a server socket to the given address.- Parameters:
address- Path to the socket.- Throws:
java.io.IOException
-
bind
public void bind(java.lang.String address) throws java.io.IOExceptionBinds a server socket to the given address.- Parameters:
address- Path to the socket.- Throws:
java.io.IOException
-
getAddress
public UnixSocketAddress getAddress()
Return the address this socket is bound to.- Returns:
- The UnixSocketAddress if bound or null if unbound.
-
isClosed
public boolean isClosed()
Check the status of the socket.- Returns:
- True if closed.
-
isBound
public boolean isBound()
Check the status of the socket.- Returns:
- True if bound.
-
-