Modifier and Type | Class and Description |
---|---|
private static class | DatagramChannelImpl.
Defines static methods to access AbstractSelectableChannel non-public members. |
private static class | DatagramChannelImpl.
Defines static methods to get/set DatagramPacket fields and workaround DatagramPacket deficiencies. |
private static class |
Modifier and Type | Field and Description |
---|---|
private InetSocketAddress | |
private NativeSocketAddress | |
private final Cleaner. | |
private final ProtocolFamily | |
private final FileDescriptor | |
private final int | |
private volatile boolean | |
private InetSocketAddress | |
private final boolean | |
private boolean | |
private InetSocketAddress | |
private static final NativeDispatcher | |
private static final JavaNioAccess | |
private int | |
private InetSocketAddress | |
private long | |
private final ReentrantLock | |
private MembershipRegistry | |
private InetSocketAddress | |
private boolean | |
private static final VarHandle | |
private volatile DatagramSocket | |
private NativeSocketAddress | |
private static final int | |
private static final int | |
private static final int | |
private static final int | |
private int | |
private final Object | |
private final NativeSocketAddress | |
private final ReentrantLock | |
private long |
Access | Constructor and Description |
---|---|
pack-priv | |
pack-priv | |
pack-priv |
Modifier and Type | Method and Description |
---|---|
private SocketAddress | Returns: remote address if connectedtrue if configured blocking blocking, boolean true if the socket must be connected mustBeConnected)Marks the beginning of a read operation that might block. |
private SocketAddress | Returns: remote address if connectedtrue if configured blocking blocking, boolean true if the socket must be connected mustBeConnected)Marks the beginning of a write operation that might block. |
public DatagramChannel | bind(SocketAddress
The address to bind the socket, or local)null to bind the socket
to an automatically assigned socket addressImplements abstract java. Implements java. Binds the channel's socket to a local address. |
private void | |
pack-priv void | |
pack-priv void | |
pack-priv void | |
private void | |
private void | configureSocketNonBlockingIfVirtualThread()
Ensures that the socket is configured non-blocking when on a virtual thread. |
public DatagramChannel | connect(SocketAddress
The remote address to which this channel is to be connected sa)Implements abstract java. Connects this channel's socket. |
pack-priv DatagramChannel | connect(SocketAddress
the remote address to which this channel is to be connected sa, boolean true to check if the channel is already connected. check)Connects the channel's socket. |
public DatagramChannel | disconnect()
Implements abstract java. Disconnects this channel's socket. |
private static native void | |
pack-priv void | |
private void | endRead(boolean blocking, boolean completed)
Marks the end of a read operation that may have blocked. |
private void | endWrite(boolean blocking, boolean completed)
Marks the end of a write operation that may have blocked. |
private void | |
private ProtocolFamily | familyFor(SocketOption<?> name)
Returns the protocol family to specify to set/getSocketOption for the given socket option. |
pack-priv MembershipKey | findMembership(InetAddress group, NetworkInterface interf)
Finds an existing membership of a multicast group. |
public FileDescriptor | |
public int | |
public SocketAddress | getLocalAddress()
Implements abstract java. Implements java. Returns the socket address that this channel's socket is bound to. |
public <T> T | getOption(SocketOption<T>
The socket option name)Implements java. Returns the value of a socket option. |
public SocketAddress | getRemoteAddress()
Implements abstract java. Returns the remote address to which this channel's socket is connected. |
private void | |
private void | |
protected void | implCloseSelectableChannel()
Implements abstract java. Invoked by implCloseChannel to close the channel. |
protected void | implConfigureBlocking(boolean
If block)true then this channel will be placed in
blocking mode; if false then it will be placed
non-blocking modeImplements abstract java. Adjusts this channel's blocking mode. |
private MembershipKey | innerJoin(InetAddress group, NetworkInterface interf, InetAddress source)
Joins channel's socket to the given group/interface and optional source address. |
public boolean | isConnected()
Implements abstract java. Tells whether or not this channel's socket is connected. |
public MembershipKey | join(InetAddress
The multicast address to join group, NetworkInterface The network interface on which to join the group interf)Implements java. Joins a multicast group to begin receiving all datagrams sent to the group, returning a membership key. |
public MembershipKey | join(InetAddress
The multicast address to join group, NetworkInterface The network interface on which to join the group interf, InetAddress The source address source)Implements java. Joins a multicast group to begin receiving datagrams sent to the group from a given source address. |
public void | |
pack-priv InetSocketAddress | |
private void | |
public void | park(int
the event to poll event, long the timeout to wait; nanos)<= 0 to wait indefinitelyOverrides default sun. Disables the current thread for scheduling purposes until this channel is ready for I/O, or asynchronously closed, for up to the specified waiting time. |
public int | read(ByteBuffer
The buffer into which bytes are to be transferred buf)Implements abstract java. Implements java. Reads a datagram from this channel. |
public long | read(ByteBuffer[]
The buffers into which bytes are to be transferred dsts, int The offset within the buffer array of the first buffer into
which bytes are to be transferred; must be non-negative and no
larger than offset, int dsts.length The maximum number of buffers to be accessed; must be
non-negative and no larger than
length)dsts.length - offset Implements abstract java. Implements java. Reads a datagram from this channel. |
public SocketAddress | receive(ByteBuffer
The buffer into which the datagram is to be transferred dst)Implements abstract java. Receives a datagram via this channel. |
private int | receive(ByteBuffer dst, boolean
true if the channel is connected connected)Receives a datagram into the buffer. |
private static native int | |
private int | receiveIntoNativeBuffer(ByteBuffer bb, int rem, int pos, boolean connected)
Receives a datagram into a direct buffer. |
private static Runnable | releaserFor(FileDescriptor fd, NativeSocketAddress... sockAddrs)
Returns an action to release the given file descriptor and socket addresses. |
pack-priv InetSocketAddress | |
private void | repairSocket(InetSocketAddress target)
"Repair" the channel's socket after a disconnect that didn't restore the local address. |
public int | send(ByteBuffer
The buffer containing the datagram to be sent src, SocketAddress The address to which the datagram is to be sent target)Implements abstract java. Sends a datagram via this channel. |
private int | |
private static native int | |
private int | sendFromNativeBuffer(FileDescriptor fd, ByteBuffer bb, InetSocketAddress target)
Send a datagram contained in a direct buffer. |
public <T> DatagramChannel | setOption(SocketOption<T>
The socket option name, T The value of the socket option. A value of value)null may be
a valid value for some socket options.Implements abstract java. Implements java. Sets the value of a socket option. |
public DatagramSocket | socket()
Implements abstract java. Retrieves a datagram socket associated with this channel. |
private InetSocketAddress | sourceSocketAddress()
Return an InetSocketAddress to represent the source/sender socket address in sourceSockAddr. |
public final Set | supportedOptions()
Implements java. Returns a set of the socket options supported by this channel. |
private int | targetSocketAddress(InetSocketAddress isa)
Encodes the given InetSocketAddress into targetSockAddr, returning the length of the sockaddr structure (sizeof struct sockaddr or sockaddr6). |
public boolean | translateAndSetReadyOps(int ops, SelectionKeyImpl ski)
Implements sun. Sets the specified ops if present in interestOps. |
public boolean | translateAndUpdateReadyOps(int ops, SelectionKeyImpl ski)
Implements sun. Adds the specified ops if present in interestOps. |
public int | translateInterestOps(int ops)
Implements sun. Translates an interest operation set into a native poll event set |
public boolean | translateReadyOps(int ops, int initialOps, SelectionKeyImpl ski)
Translates native poll revent set into a ready operation set |
private ByteBuffer | Returns: a direct buffer containing the datagram or null if channel is closedif the channel's socket is connected connected, int the maximum size of the datagram to receive len, long the timeout, should be Long.MAX_VALUE for untimed nanos)Attempt to receive a datagram. |
private boolean | tryClose()
Closes the socket if there are no I/O operations in progress and the channel is not registered with a Selector. |
private void | |
private boolean | Returns: true if the blocking mode was adjustedAttempts to adjust the blocking mode if the channel is open. |
pack-priv void | |
private SocketAddress | |
public int | write(ByteBuffer
The buffer from which bytes are to be retrieved buf)Implements abstract java. Implements java. Writes a datagram to this channel. |
public long | write(ByteBuffer[]
The buffers from which bytes are to be retrieved srcs, int The offset within the buffer array of the first buffer from
which bytes are to be retrieved; must be non-negative and no
larger than offset, int srcs.length The maximum number of buffers to be accessed; must be
non-negative and no larger than
length)srcs.length - offset Implements abstract java. Implements java. Writes a datagram to this channel. |