Package cx.ath.matthew.unix
Class UnixServerSocket
- java.lang.Object
-
- cx.ath.matthew.unix.UnixServerSocket
-
public class UnixServerSocket extends Object
Represents 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(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(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 IOException
Create a server socket bound to the given address.- Parameters:
address- Path to the socket.- Throws:
IOException
-
UnixServerSocket
public UnixServerSocket(String address) throws IOException
Create a server socket bound to the given address.- Parameters:
address- Path to the socket.- Throws:
IOException
-
-
Method Detail
-
accept
public UnixSocket accept() throws IOException
Accepts a connection on the ServerSocket.- Returns:
- A UnixSocket connected to the accepted connection.
- Throws:
IOException
-
close
public void close() throws IOExceptionCloses the ServerSocket.- Throws:
IOException
-
bind
public void bind(UnixSocketAddress address) throws IOException
Binds a server socket to the given address.- Parameters:
address- Path to the socket.- Throws:
IOException
-
bind
public void bind(String address) throws IOException
Binds a server socket to the given address.- Parameters:
address- Path to the socket.- Throws:
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.
-
-