public class UnixDatagramSocket
extends java.net.DatagramSocket
Constructor and Description |
---|
UnixDatagramSocket()
Constructs a new unbound instance.
|
Modifier and Type | Method and Description |
---|---|
void |
bind(java.net.SocketAddress local)
Binds this UnixDatagramSocket to a specific AF_UNIX address.
|
void |
close() |
void |
connect(java.net.InetAddress addr,
int port) |
void |
connect(java.net.SocketAddress addr) |
void |
disconnect() |
java.nio.channels.DatagramChannel |
getChannel() |
Credentials |
getCredentials()
Retrieves the credentials for this UNIX socket.
|
java.net.InetAddress |
getInetAddress()
Returns the address to which this socket is connected (NOT implemented).
|
java.net.SocketAddress |
getLocalSocketAddress()
Returns the address of the endpoint this socket is bound to.
|
int |
getReceiveBufferSize() |
java.net.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(java.net.DatagramPacket p)
Receives a datagram packet from this socket (NOT implemented).
|
void |
send(java.net.DatagramPacket p)
Sends a datagram packet from this socket (NOT implemented).
|
void |
setReceiveBufferSize(int size) |
void |
setSendBufferSize(int size) |
void |
setSoTimeout(int timeout) |
public UnixDatagramSocket() throws java.net.SocketException
java.net.SocketException
- if the socket could not be created.public void bind(java.net.SocketAddress local) throws java.net.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 java.net.DatagramSocket
local
- The UnixSocketAddress
to bind to.java.net.SocketException
- if any error happens during the bind, or if the
socket is already bound.java.nio.channels.UnsupportedAddressTypeException
- if addr is a SocketAddress subclass
not supported by this socket.public void disconnect()
disconnect
in class java.net.DatagramSocket
public void close()
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.net.DatagramSocket
public void connect(java.net.SocketAddress addr) throws java.net.SocketException
connect
in class java.net.DatagramSocket
java.net.SocketException
public void connect(java.net.InetAddress addr, int port)
connect
in class java.net.DatagramSocket
public java.nio.channels.DatagramChannel getChannel()
getChannel
in class java.net.DatagramSocket
public java.net.InetAddress getInetAddress()
null
.
Use getRemoteSocketAddress()
instead, which always returns a UnixSocketAddress
.getInetAddress
in class java.net.DatagramSocket
null
always.public java.net.SocketAddress getLocalSocketAddress()
getLocalSocketAddress
in class java.net.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 java.net.SocketAddress getRemoteSocketAddress()
null
if it is unconnected.getRemoteSocketAddress
in class java.net.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 java.net.DatagramSocket
public boolean isClosed()
isClosed
in class java.net.DatagramSocket
public boolean isConnected()
isConnected
in class java.net.DatagramSocket
public final Credentials getCredentials() throws java.net.SocketException
java.lang.UnsupportedOperationException
- if the underlying socket library
doesn't support the SO_PEERCRED optionjava.net.SocketException
- if fetching the socket option failed.public int getReceiveBufferSize() throws java.net.SocketException
getReceiveBufferSize
in class java.net.DatagramSocket
java.net.SocketException
public int getSendBufferSize() throws java.net.SocketException
getSendBufferSize
in class java.net.DatagramSocket
java.net.SocketException
public int getSoTimeout() throws java.net.SocketException
getSoTimeout
in class java.net.DatagramSocket
java.net.SocketException
public void setReceiveBufferSize(int size) throws java.net.SocketException
setReceiveBufferSize
in class java.net.DatagramSocket
java.net.SocketException
public void setSendBufferSize(int size) throws java.net.SocketException
setSendBufferSize
in class java.net.DatagramSocket
java.net.SocketException
public void setSoTimeout(int timeout) throws java.net.SocketException
setSoTimeout
in class java.net.DatagramSocket
java.net.SocketException
public void send(java.net.DatagramPacket p) throws java.io.IOException
DatagramPacket
is final and can not deal
with AF_UNIX addresses. Therefore, this functionality was omitted.send
in class java.net.DatagramSocket
java.lang.UnsupportedOperationException
- always.java.io.IOException
DatagramPacket
,
DatagramSocket.send(java.net.DatagramPacket)
public void receive(java.net.DatagramPacket p) throws java.io.IOException
DatagramPacket
is final and can not deal
with AF_UNIX addresses. Therefore, this functionality was omitted.receive
in class java.net.DatagramSocket
java.lang.UnsupportedOperationException
- always.java.io.IOException
DatagramPacket
,
DatagramSocket.receive(java.net.DatagramPacket)
Copyright © 2021. All Rights Reserved.