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, setTrafficClasspublic 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 DatagramSocketlocal - 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 DatagramSocketpublic void close()
close in interface Closeableclose in interface AutoCloseableclose in class DatagramSocketpublic void connect(SocketAddress addr) throws SocketException
connect in class DatagramSocketSocketExceptionpublic void connect(InetAddress addr, int port)
connect in class DatagramSocketpublic DatagramChannel getChannel()
getChannel in class DatagramSocketpublic InetAddress getInetAddress()
null.
Use getRemoteSocketAddress() instead, which always returns a UnixSocketAddress.getInetAddress in class DatagramSocketnull always.public SocketAddress getLocalSocketAddress()
getLocalSocketAddress in class DatagramSocketSocketAddress 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 UnixSocketAddressbind(SocketAddress)public SocketAddress getRemoteSocketAddress()
null if it is unconnected.getRemoteSocketAddress in class DatagramSocketSocketAddress representing the remote
endpoint of this socket, or null if it is
not connected.
A non-null return value is always of type UnixSocketAddresspublic boolean isBound()
isBound in class DatagramSocketpublic boolean isClosed()
isClosed in class DatagramSocketpublic boolean isConnected()
isConnected in class DatagramSocketpublic 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 DatagramSocketSocketExceptionpublic int getSendBufferSize()
throws SocketException
getSendBufferSize in class DatagramSocketSocketExceptionpublic int getSoTimeout()
throws SocketException
getSoTimeout in class DatagramSocketSocketExceptionpublic void setReceiveBufferSize(int size)
throws SocketException
setReceiveBufferSize in class DatagramSocketSocketExceptionpublic void setSendBufferSize(int size)
throws SocketException
setSendBufferSize in class DatagramSocketSocketExceptionpublic void setSoTimeout(int timeout)
throws SocketException
setSoTimeout in class DatagramSocketSocketExceptionpublic 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 DatagramSocketUnsupportedOperationException - always.IOExceptionDatagramPacket,
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 DatagramSocketUnsupportedOperationException - always.IOExceptionDatagramPacket,
DatagramSocket.receive(java.net.DatagramPacket)Copyright © 2017. All rights reserved.