public class UnixSocket
extends java.lang.Object
Constructor and Description |
---|
UnixSocket()
Create an unconnected socket.
|
UnixSocket(java.lang.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(java.lang.String address)
Connect the socket to this address.
|
void |
connect(UnixSocketAddress 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.
|
java.io.InputStream |
getInputStream()
Returns an InputStream for reading from the socket.
|
java.io.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 java.io.IOException
address
- The Unix Socket address to connect tojava.io.IOException
public UnixSocket(java.lang.String address) throws java.io.IOException
address
- The Unix Socket address to connect tojava.io.IOException
public void connect(UnixSocketAddress address) throws java.io.IOException
address
- The Unix Socket address to connect tojava.io.IOException
public void connect(java.lang.String address) throws java.io.IOException
address
- The Unix Socket address to connect tojava.io.IOException
public void finalize()
finalize
in class java.lang.Object
public void close() throws java.io.IOException
java.io.IOException
public java.io.InputStream getInputStream()
public java.io.OutputStream getOutputStream()
public UnixSocketAddress getAddress()
public void sendCredentialByte(byte data) throws java.io.IOException
data
- The byte of data to send.java.io.IOException
public byte recvCredentialByte() throws java.io.IOException
data
- The byte of data to send.java.io.IOException
getPeerUID
,
getPeerPID
,
getPeerGID
public boolean getPassCred()
setPassCred
public int getPeerUID()
public int getPeerGID()
public int getPeerPID()
public void setPassCred(boolean enable) throws java.io.IOException
enable
- Set to true for credentials to be passed.java.io.IOException
public boolean getBlocking()
setBlocking
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)