public class UnixSocket extends Object
Constructor | Description |
---|---|
UnixSocket() |
Create an unconnected socket.
|
UnixSocket(UnixSocketAddress address) |
Create a socket connected to the given address.
|
UnixSocket(String address) |
Create a socket connected to the given address.
|
Modifier and Type | Method | Description |
---|---|---|
void |
close() |
Closes the connection.
|
void |
connect(UnixSocketAddress address) |
Connect the socket to this address.
|
void |
connect(String address) |
Connect the socket to this address.
|
void |
finalize() |
|
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.
|
public UnixSocket()
public UnixSocket(UnixSocketAddress address) throws IOException
address
- The Unix Socket address to connect toIOException
public UnixSocket(String address) throws IOException
address
- The Unix Socket address to connect toIOException
public void connect(UnixSocketAddress address) throws IOException
address
- The Unix Socket address to connect toIOException
public void connect(String address) throws IOException
address
- The Unix Socket address to connect toIOException
public void close() throws IOException
IOException
public InputStream getInputStream()
public OutputStream getOutputStream()
public UnixSocketAddress getAddress()
public void sendCredentialByte(byte data) throws IOException
data
- The byte of data to send.IOException
public byte recvCredentialByte() throws IOException
data
- The byte of data to send.IOException
getPeerUID()
,
getPeerPID()
,
getPeerGID()
public boolean getPassCred()
setPassCred(boolean)
public 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
public boolean getBlocking()
setBlocking(boolean)
public void setBlocking(boolean enable)
enable
- Set to false for non-blocking reads.public boolean isClosed()
public boolean isConnected()
public boolean isInputShutdown()
public boolean isOutputShutdown()
public void shutdownInput()
public void shutdownOutput()
public void setSoTimeout(int timeout)