Class UnixSocketTransport
java.lang.Object
org.freedesktop.dbus.connections.transports.AbstractTransport
org.freedesktop.dbus.connections.transports.AbstractUnixTransport
org.freedesktop.dbus.transport.jnr.UnixSocketTransport
- All Implemented Interfaces:
Closeable,AutoCloseable
Transport type representing a transport connection to a unix socket.
- Since:
- v3.2.0 - 2019-02-08
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate jnr.unixsocket.UnixServerSocketChannelprivate jnr.unixsocket.UnixSocketChannelprivate final jnr.unixsocket.UnixSocketAddress -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionMethod to accept new incoming listening connections.
This is the place whereaccept()is called on the server socket created byAbstractTransport.bindImpl().
Therefore this method will block until a client is connected.voidbindImpl()Method called to prepare listening for connections.
This is usually the place where theServerSocketChannelis created andbind()is called.protected voidMethod which is called to close a transport.
Should be used to close all sockets and/or serversockets.Establish a connection to DBus using unix sockets.intgetUid(SocketChannel _sock) protected booleanMethod to indicate if passing of file descriptors is allowed.protected booleanisBound()Status of the server socket if this transport is configured to be a server connection.
Must be false ifAbstractTransport.bindImpl()was not called.Methods inherited from class org.freedesktop.dbus.connections.transports.AbstractTransport
close, connect, getAddress, getLogger, getMessageFactory, getSaslConfig, getTransportConfig, getTransportConnection, isConnected, isFileDescriptorSupported, isListening, listen, readMessage, setPreConnectCallback, toString, writeMessage
-
Field Details
-
unixSocketAddress
private final jnr.unixsocket.UnixSocketAddress unixSocketAddress -
socket
private jnr.unixsocket.UnixSocketChannel socket -
serverSocket
private jnr.unixsocket.UnixServerSocketChannel serverSocket
-
-
Constructor Details
-
UnixSocketTransport
UnixSocketTransport(JnrUnixBusAddress _address, TransportConfig _config) throws TransportConfigurationException - Throws:
TransportConfigurationException
-
-
Method Details
-
hasFileDescriptorSupport
protected boolean hasFileDescriptorSupport()Description copied from class:AbstractTransportMethod to indicate if passing of file descriptors is allowed.- Specified by:
hasFileDescriptorSupportin classAbstractTransport- Returns:
- true to allow FD passing, false otherwise
-
isBound
protected boolean isBound()Description copied from class:AbstractTransportStatus of the server socket if this transport is configured to be a server connection.
Must be false ifAbstractTransport.bindImpl()was not called.- Specified by:
isBoundin classAbstractTransport- Returns:
- boolean
-
bindImpl
Description copied from class:AbstractTransportMethod called to prepare listening for connections.
This is usually the place where theServerSocketChannelis created andbind()is called.- Specified by:
bindImplin classAbstractTransport- Throws:
IOException- when connection fails
-
acceptImpl
Description copied from class:AbstractTransportMethod to accept new incoming listening connections.
This is the place whereaccept()is called on the server socket created byAbstractTransport.bindImpl().
Therefore this method will block until a client is connected.- Specified by:
acceptImplin classAbstractTransport- Returns:
- newly connected client socket
- Throws:
IOException- when connection fails
-
connectImpl
Establish a connection to DBus using unix sockets.- Specified by:
connectImplin classAbstractTransport- Returns:
- socket channel connected to DBus server
- Throws:
IOException- on error
-
closeTransport
Description copied from class:AbstractTransportMethod which is called to close a transport.
Should be used to close all sockets and/or serversockets.- Specified by:
closeTransportin classAbstractTransport- Throws:
IOException- when something fails while closing transport
-
getUid
- Specified by:
getUidin classAbstractUnixTransport- Throws:
IOException
-