Package jnr.unixsocket
Class UnixSocket
java.lang.Object
java.net.Socket
jnr.unixsocket.UnixSocket
- All Implemented Interfaces:
Closeable
,AutoCloseable
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final class
A byte channel that doesn't implementSelectableChannel
. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate UnixSocketChannel
private AtomicBoolean
private InputStream
private AtomicBoolean
private OutputStream
private AtomicBoolean
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
bind
(SocketAddress local) void
close()
void
connect
(SocketAddress addr) void
connect
(SocketAddress addr, int timeout) final Credentials
Retrieves the credentials for this UNIX socket.boolean
int
int
int
private void
ignore()
boolean
isBound()
boolean
isClosed()
boolean
boolean
boolean
void
setKeepAlive
(boolean on) void
setReceiveBufferSize
(int size) void
setSendBufferSize
(int size) void
setSoTimeout
(int timeout) void
void
Methods inherited from class java.net.Socket
getLocalAddress, getLocalPort, getOOBInline, getPort, getReuseAddress, getSoLinger, getTcpNoDelay, getTrafficClass, sendUrgentData, setOOBInline, setPerformancePreferences, setReuseAddress, setSocketImplFactory, setSoLinger, setTcpNoDelay, setTrafficClass, toString
-
Field Details
-
chan
-
closed
-
indown
-
outdown
-
in
-
out
-
-
Constructor Details
-
UnixSocket
-
-
Method Details
-
bind
- Overrides:
bind
in classSocket
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classSocket
- Throws:
IOException
-
connect
- Overrides:
connect
in classSocket
- Throws:
IOException
-
connect
- Overrides:
connect
in classSocket
- Throws:
IOException
-
getChannel
- Overrides:
getChannel
in classSocket
-
getInetAddress
- Overrides:
getInetAddress
in classSocket
-
getInputStream
- Overrides:
getInputStream
in classSocket
- Throws:
IOException
-
getLocalSocketAddress
- Overrides:
getLocalSocketAddress
in classSocket
-
getOutputStream
- Overrides:
getOutputStream
in classSocket
- Throws:
IOException
-
getRemoteSocketAddress
- Overrides:
getRemoteSocketAddress
in classSocket
-
isBound
public boolean isBound() -
isClosed
public boolean isClosed() -
isConnected
public boolean isConnected()- Overrides:
isConnected
in classSocket
-
isInputShutdown
public boolean isInputShutdown()- Overrides:
isInputShutdown
in classSocket
-
isOutputShutdown
public boolean isOutputShutdown()- Overrides:
isOutputShutdown
in classSocket
-
shutdownInput
- Overrides:
shutdownInput
in classSocket
- Throws:
IOException
-
shutdownOutput
- Overrides:
shutdownOutput
in classSocket
- Throws:
IOException
-
getCredentials
Retrieves the credentials for this UNIX socket. Clients calling this method will receive the server's credentials, and servers will receive the client's credentials. User ID, group ID, and PID are supplied. See man unix 7; SCM_CREDENTIALS- Returns:
- the credentials of the remote; null if not connected
- Throws:
UnsupportedOperationException
- if the underlying socket library doesn't support the SO_PEERCRED optionSocketException
- if fetching the socket option failed.
-
getKeepAlive
- Overrides:
getKeepAlive
in classSocket
- Throws:
SocketException
-
getReceiveBufferSize
- Overrides:
getReceiveBufferSize
in classSocket
- Throws:
SocketException
-
getSendBufferSize
- Overrides:
getSendBufferSize
in classSocket
- Throws:
SocketException
-
getSoTimeout
- Overrides:
getSoTimeout
in classSocket
- Throws:
SocketException
-
setKeepAlive
- Overrides:
setKeepAlive
in classSocket
- Throws:
SocketException
-
setReceiveBufferSize
- Overrides:
setReceiveBufferSize
in classSocket
- Throws:
SocketException
-
setSendBufferSize
- Overrides:
setSendBufferSize
in classSocket
- Throws:
SocketException
-
setSoTimeout
- Overrides:
setSoTimeout
in classSocket
- Throws:
SocketException
-
ignore
private void ignore()
-