Package cx.ath.matthew.unix
Class UnixServerSocket
- java.lang.Object
-
- cx.ath.matthew.unix.UnixServerSocket
-
public class UnixServerSocket extends java.lang.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(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 UnixSocket
accept()
Accepts a connection on the ServerSocket.void
bind(UnixSocketAddress address)
Binds a server socket to the given address.void
bind(java.lang.String address)
Binds a server socket to the given address.void
close()
Closes the ServerSocket.UnixSocketAddress
getAddress()
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 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.IOException
Create 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.IOException
Closes 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.IOException
Binds 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.
-
-