|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--gnu.net.local.AfUnixServerSocket
This class models local AF_UNIX server side sockets. The basic model is that the server socket is created and bound to some well known unix filesystem address (a file representing the socket is created) It then listens for and accepts connections.
Be aware that the socket-file is not removed after closing the server-socket.
To use this library you have to include the native library 'libgnu_net_localX.so' in your LD_LIBRARY_PATH
If you want to check whether the AF_UNIX native library can be loaded/used at all before creating a socket try AfUnixSocketImpl.loadNativeLibrary() and catch UnsatisfiedLinkError.
| Constructor Summary | |
AfUnixServerSocket()
Constructor that simply sets the implementation. |
|
AfUnixServerSocket(java.lang.String sockname)
Creates a server socket and binds it to the specified filename. |
|
AfUnixServerSocket(java.lang.String sockname,
int backlog)
Creates a server socket and binds it to the specified filename. |
|
| Method Summary | |
AfUnixSocket |
accept()
Accepts a new connection and returns a connected Socket
instance representing that connection. |
void |
bind(java.lang.String sockname)
Binds the server socket to a specified socket name |
void |
bind(java.lang.String sockname,
int backlog)
Binds the server socket to a specified socket name |
void |
close()
Closes this socket and stops listening for connections |
protected void |
implAccept(AfUnixSocket s)
This protected method is used to help subclasses override ServerSocket.accept(). |
java.lang.String |
toString()
Returns the value of this socket as a String. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public AfUnixServerSocket()
throws java.io.IOException
java.io.IOException - If an error occurs
java.lang.UnsatisfiedLinkError - loads the native library - throws UnsatisfiedLinkError on failure
public AfUnixServerSocket(java.lang.String sockname)
throws java.io.IOException
sockname - The 'filename' to bind to
java.io.IOException - If an error occurs
java.lang.UnsatisfiedLinkError - loads the native library - throws UnsatisfiedLinkError on failure
public AfUnixServerSocket(java.lang.String sockname,
int backlog)
throws java.io.IOException
sockname - The 'filename' to bind tobacklog - The length of the pending connection queue
java.io.IOException - If an error occurs
java.lang.UnsatisfiedLinkError - loads the native library - throws UnsatisfiedLinkError on failure| Method Detail |
public void bind(java.lang.String sockname)
throws java.io.IOException
sockname - The socket name to bind to
java.io.IOException - If an error occurs
public void bind(java.lang.String sockname,
int backlog)
throws java.io.IOException
sockname - The socket name to bind tobacklog - The length of the pending connection queue
java.io.IOException - If an error occurs
public AfUnixSocket accept()
throws java.io.IOException
Socket
instance representing that connection. This method will block until a
connection is available.
java.io.IOException - If an error occurs
IllegalBlockingModeException - If this socket has an associated
channel, and the channel is in non-blocking mode
SocketTimeoutException - If a timeout was previously set with
setSoTimeout and the timeout has been reached
protected final void implAccept(AfUnixSocket s)
throws java.io.IOException
ServerSocket.accept(). The passed in socket will be
connected when this method returns.
java.io.IOException - If an error occurs
IllegalBlockingModeException - If this socket has an associated
channel, and the channel is in non-blocking mode (not implemented)
public void close()
throws java.io.IOException
java.io.IOException - If an error occurspublic java.lang.String toString()
String.
toString in class java.lang.ObjectString.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||