Package cx.ath.matthew.unix
Class UnixServerSocket
java.lang.Object
cx.ath.matthew.unix.UnixServerSocket
Represents a listening UNIX Socket.
-
Constructor Summary
ConstructorsConstructorDescriptionCreate 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
Modifier and TypeMethodDescriptionaccept()
Accepts a connection on the ServerSocket.void
bind
(UnixSocketAddress address) Binds a server socket to the given address.void
Binds a server socket to the given address.void
close()
Closes the ServerSocket.Return the address this socket is bound to.boolean
isBound()
Check the status of the socket.boolean
isClosed()
Check the status of the socket.
-
Constructor Details
-
UnixServerSocket
public UnixServerSocket()Create an un-bound server socket. -
UnixServerSocket
Create a server socket bound to the given address.- Parameters:
address
- Path to the socket.- Throws:
IOException
-
UnixServerSocket
Create a server socket bound to the given address.- Parameters:
address
- Path to the socket.- Throws:
IOException
-
-
Method Details
-
accept
Accepts a connection on the ServerSocket.- Returns:
- A UnixSocket connected to the accepted connection.
- Throws:
IOException
-
close
Closes the ServerSocket.- Throws:
IOException
-
bind
Binds a server socket to the given address.- Parameters:
address
- Path to the socket.- Throws:
IOException
-
bind
Binds a server socket to the given address.- Parameters:
address
- Path to the socket.- Throws:
IOException
-
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.
-