public class UnixSocket extends Socket implements Closeable
| Constructor and Description |
|---|
UnixSocket()
Create an unconnected socket.
|
UnixSocket(String _address)
Create a socket connected to the given address.
|
UnixSocket(UnixSocketAddress _address)
Create a socket connected to the given address.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the connection.
|
void |
connect(String _address)
Connect the socket to this address.
|
void |
connect(UnixSocketAddress _address)
Connect the socket to this address.
|
UnixSocketAddress |
getAddress()
Returns the address this socket is connected to.
|
boolean |
getBlocking()
Get the blocking mode.
|
InputStream |
getInputStream()
Returns an InputStream for reading from the socket.
|
OutputStream |
getOutputStream()
Returns an OutputStream for writing to the socket.
|
boolean |
getPassCred()
Get the credential passing status.
|
int |
getPeerGID()
Return the gid of the remote process.
|
int |
getPeerPID()
Return the pid of the remote process.
|
int |
getPeerUID()
Return the uid of the remote process.
|
boolean |
isClosed()
Check the socket status.
|
boolean |
isConnected()
Check the socket status.
|
boolean |
isInputShutdown()
Check the socket status.
|
boolean |
isOutputShutdown()
Check the socket status.
|
byte |
recvCredentialByte()
Receive a single byte of data, with credentials.
|
void |
sendCredentialByte(byte data)
Send a single byte of data with credentials.
|
void |
setBlocking(boolean enable)
Set the blocking mode.
|
void |
setPassCred(boolean enable)
Set the credential passing status.
|
void |
setSoTimeout(int timeout)
Set timeout of read requests.
|
void |
shutdownInput()
Shuts down the input stream.
|
void |
shutdownOutput()
Shuts down the output stream.
|
bind, connect, connect, getChannel, getInetAddress, getKeepAlive, getLocalAddress, getLocalPort, getLocalSocketAddress, getOOBInline, getPort, getReceiveBufferSize, getRemoteSocketAddress, getReuseAddress, getSendBufferSize, getSoLinger, getSoTimeout, getTcpNoDelay, getTrafficClass, isBound, sendUrgentData, setKeepAlive, setOOBInline, setPerformancePreferences, setReceiveBufferSize, setReuseAddress, setSendBufferSize, setSocketImplFactory, setSoLinger, setTcpNoDelay, setTrafficClass, toStringpublic UnixSocket()
public UnixSocket(UnixSocketAddress _address) throws IOException
_address - The Unix Socket address to connect toIOException - on errorpublic UnixSocket(String _address) throws IOException
_address - The Unix Socket address to connect toIOException - on errorpublic void connect(UnixSocketAddress _address) throws IOException
_address - The Unix Socket address to connect toIOException - on errorpublic void connect(String _address) throws IOException
_address - The Unix Socket address to connect toIOException - on errorpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class SocketIOException - on errorpublic InputStream getInputStream()
getInputStream in class Socketpublic OutputStream getOutputStream()
getOutputStream in class Socketpublic UnixSocketAddress getAddress()
public void sendCredentialByte(byte data)
throws IOException
data - The byte of data to send.IOException - on errorpublic byte recvCredentialByte()
throws IOException
IOException - on errorgetPeerUID,
getPeerPID,
getPeerGIDpublic boolean getPassCred()
setPassCredpublic int getPeerUID()
public int getPeerGID()
public int getPeerPID()
public void setPassCred(boolean enable)
throws IOException
enable - Set to true for credentials to be passed.IOException - on errorpublic boolean getBlocking()
setBlockingpublic void setBlocking(boolean enable)
enable - Set to false for non-blocking reads.public boolean isClosed()
public boolean isConnected()
isConnected in class Socketpublic boolean isInputShutdown()
isInputShutdown in class Socketpublic boolean isOutputShutdown()
isOutputShutdown in class Socketpublic void shutdownInput()
shutdownInput in class Socketpublic void shutdownOutput()
shutdownOutput in class Socketpublic void setSoTimeout(int timeout)
setSoTimeout in class Sockettimeout - to setCopyright © 2020. All rights reserved.