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 classA byte channel that doesn't implementSelectableChannel. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate UnixSocketChannelprivate AtomicBooleanprivate InputStreamprivate AtomicBooleanprivate OutputStreamprivate AtomicBoolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbind(SocketAddress local) voidclose()voidconnect(SocketAddress addr) voidconnect(SocketAddress addr, int timeout) final CredentialsRetrieves the credentials for this UNIX socket.booleanintintintprivate voidignore()booleanisBound()booleanisClosed()booleanbooleanbooleanvoidsetKeepAlive(boolean on) voidsetReceiveBufferSize(int size) voidsetSendBufferSize(int size) voidsetSoTimeout(int timeout) voidvoidMethods inherited from class 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:
bindin classSocket- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classSocket- Throws:
IOException
-
connect
- Overrides:
connectin classSocket- Throws:
IOException
-
connect
- Overrides:
connectin classSocket- Throws:
IOException
-
getChannel
- Overrides:
getChannelin classSocket
-
getInetAddress
- Overrides:
getInetAddressin classSocket
-
getInputStream
- Overrides:
getInputStreamin classSocket- Throws:
IOException
-
getLocalSocketAddress
- Overrides:
getLocalSocketAddressin classSocket
-
getOutputStream
- Overrides:
getOutputStreamin classSocket- Throws:
IOException
-
getRemoteSocketAddress
- Overrides:
getRemoteSocketAddressin classSocket
-
isBound
-
isClosed
-
isConnected
public boolean isConnected()- Overrides:
isConnectedin classSocket
-
isInputShutdown
public boolean isInputShutdown()- Overrides:
isInputShutdownin classSocket
-
isOutputShutdown
public boolean isOutputShutdown()- Overrides:
isOutputShutdownin classSocket
-
shutdownInput
- Overrides:
shutdownInputin classSocket- Throws:
IOException
-
shutdownOutput
- Overrides:
shutdownOutputin 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:
getKeepAlivein classSocket- Throws:
SocketException
-
getReceiveBufferSize
- Overrides:
getReceiveBufferSizein classSocket- Throws:
SocketException
-
getSendBufferSize
- Overrides:
getSendBufferSizein classSocket- Throws:
SocketException
-
getSoTimeout
- Overrides:
getSoTimeoutin classSocket- Throws:
SocketException
-
setKeepAlive
- Overrides:
setKeepAlivein classSocket- Throws:
SocketException
-
setReceiveBufferSize
- Overrides:
setReceiveBufferSizein classSocket- Throws:
SocketException
-
setSendBufferSize
- Overrides:
setSendBufferSizein classSocket- Throws:
SocketException
-
setSoTimeout
- Overrides:
setSoTimeoutin classSocket- Throws:
SocketException
-
ignore
private void ignore()
-