public class UnixDatagramSocket extends DatagramSocket
Constructor and Description |
---|
UnixDatagramSocket()
Constructs a new unbound instance.
|
Modifier and Type | Method and Description |
---|---|
void |
bind(SocketAddress local)
Binds this UnixDatagramSocket to a specific AF_UNIX address.
|
void |
close() |
void |
connect(InetAddress addr,
int port) |
void |
connect(SocketAddress addr) |
void |
disconnect() |
DatagramChannel |
getChannel() |
Credentials |
getCredentials()
Retrieves the credentials for this UNIX socket.
|
InetAddress |
getInetAddress()
Returns the address to which this socket is connected (NOT implemented).
|
SocketAddress |
getLocalSocketAddress()
Returns the address of the endpoint this socket is bound to.
|
int |
getReceiveBufferSize() |
SocketAddress |
getRemoteSocketAddress()
Returns the address of the endpoint this socket is connected to, or
null if it is unconnected. |
int |
getSendBufferSize() |
int |
getSoTimeout() |
boolean |
isBound() |
boolean |
isClosed() |
boolean |
isConnected() |
void |
receive(DatagramPacket p)
Receives a datagram packet from this socket (NOT implemented).
|
void |
send(DatagramPacket p)
Sends a datagram packet from this socket (NOT implemented).
|
void |
setReceiveBufferSize(int size) |
void |
setSendBufferSize(int size) |
void |
setSoTimeout(int timeout) |
getBroadcast, getLocalAddress, getLocalPort, getPort, getReuseAddress, getTrafficClass, setBroadcast, setDatagramSocketImplFactory, setReuseAddress, setTrafficClass
public UnixDatagramSocket() throws SocketException
SocketException
- if the socket could not be created.public void bind(SocketAddress local) throws SocketException
If the address is null
, then on Linux, an autobind will be performed,
which will bind this socket in Linux' abstract namespace on a unique path, chosen by
the system. On all other platforms, A temporary path in the regular filesystem will be chosen.
bind
in class DatagramSocket
local
- The UnixSocketAddress
to bind to.SocketException
- if any error happens during the bind, or if the
socket is already bound.UnsupportedAddressTypeException
- if addr is a SocketAddress subclass
not supported by this socket.public void disconnect()
disconnect
in class DatagramSocket
public void close()
close
in interface Closeable
close
in interface AutoCloseable
close
in class DatagramSocket
public void connect(SocketAddress addr) throws SocketException
connect
in class DatagramSocket
SocketException
public void connect(InetAddress addr, int port)
connect
in class DatagramSocket
public DatagramChannel getChannel()
getChannel
in class DatagramSocket
public InetAddress getInetAddress()
null
.
Use getRemoteSocketAddress()
instead, which always returns a UnixSocketAddress
.getInetAddress
in class DatagramSocket
null
always.public SocketAddress getLocalSocketAddress()
getLocalSocketAddress
in class DatagramSocket
SocketAddress
representing the local endpoint of this
socket, or null
if it is closed or not bound.
A non-null return value is always of type UnixSocketAddress
bind(SocketAddress)
public SocketAddress getRemoteSocketAddress()
null
if it is unconnected.getRemoteSocketAddress
in class DatagramSocket
SocketAddress
representing the remote
endpoint of this socket, or null
if it is
not connected.
A non-null return value is always of type UnixSocketAddress
public boolean isBound()
isBound
in class DatagramSocket
public boolean isClosed()
isClosed
in class DatagramSocket
public boolean isConnected()
isConnected
in class DatagramSocket
public final Credentials getCredentials() throws SocketException
UnsupportedOperationException
- if the underlying socket library
doesn't support the SO_PEERCRED optionSocketException
- if fetching the socket option failed.public int getReceiveBufferSize() throws SocketException
getReceiveBufferSize
in class DatagramSocket
SocketException
public int getSendBufferSize() throws SocketException
getSendBufferSize
in class DatagramSocket
SocketException
public int getSoTimeout() throws SocketException
getSoTimeout
in class DatagramSocket
SocketException
public void setReceiveBufferSize(int size) throws SocketException
setReceiveBufferSize
in class DatagramSocket
SocketException
public void setSendBufferSize(int size) throws SocketException
setSendBufferSize
in class DatagramSocket
SocketException
public void setSoTimeout(int timeout) throws SocketException
setSoTimeout
in class DatagramSocket
SocketException
public void send(DatagramPacket p) throws IOException
DatagramPacket
is final and can not deal
with AF_UNIX addresses. Therefore, this functionality was omitted.send
in class DatagramSocket
UnsupportedOperationException
- always.IOException
DatagramPacket
,
DatagramSocket.send(java.net.DatagramPacket)
public void receive(DatagramPacket p) throws IOException
DatagramPacket
is final and can not deal
with AF_UNIX addresses. Therefore, this functionality was omitted.receive
in class DatagramSocket
UnsupportedOperationException
- always.IOException
DatagramPacket
,
DatagramSocket.receive(java.net.DatagramPacket)
Copyright © 2020. All rights reserved.