Class DatagramChannelEndPoint
java.lang.Object
org.eclipse.jetty.io.IdleTimeout
org.eclipse.jetty.io.AbstractEndPoint
org.eclipse.jetty.io.SelectableChannelEndPoint
org.eclipse.jetty.io.DatagramChannelEndPoint
- All Implemented Interfaces:
Closeable, AutoCloseable, EndPoint, ManagedSelector.Selectable
An EndPoint implementation based on DatagramChannel.
-
Nested Class Summary
Nested classes/interfaces inherited from interface EndPoint
EndPoint.Pipe, EndPoint.SslSessionData, EndPoint.Wrapper -
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionDatagramChannelEndPoint(DatagramChannel channel, ManagedSelector selector, SelectionKey key, Scheduler scheduler) -
Method Summary
Modifier and TypeMethodDescriptionreceive(ByteBuffer buffer) Receives data into the given buffer from the returned address.booleansend(SocketAddress address, ByteBuffer... buffers) Sends to the given address the data in the given buffers.voidwrite(Callback callback, SocketAddress address, ByteBuffer... buffers) Writes to the given address the data contained in the given buffers, and invokes the given callback when either all the data has been sent, or a failure occurs.Methods inherited from class SelectableChannelEndPoint
doClose, getLocalSocketAddress, getTransport, isOpen, needsFillInterest, onClose, onIncompleteFlush, onSelected, replaceKey, toEndPointString, updateKeyMethods inherited from class AbstractEndPoint
close, close, doShutdownInput, doShutdownOutput, fillInterested, getConnection, getCreatedTimeStamp, getFillInterest, getLocalAddress, getRemoteAddress, getWriteFlusher, isFillInterested, isInputShutdown, isOutputShutdown, onClose, onIdleExpired, onOpen, reset, setConnection, shutdownInput, shutdownOutput, toConnectionString, toString, tryFillInterested, upgrade, writeMethods inherited from class IdleTimeout
checkIdleTimeout, getIdleFor, getIdleTimeout, getScheduler, notIdle, setIdleTimeoutMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface EndPoint
fill, flush, getIdleTimeout, getSslSessionData, isSecure, setIdleTimeout
-
Constructor Details
-
DatagramChannelEndPoint
public DatagramChannelEndPoint(DatagramChannel channel, ManagedSelector selector, SelectionKey key, Scheduler scheduler)
-
-
Method Details
-
getChannel
- Overrides:
getChannelin classSelectableChannelEndPoint
-
getRemoteSocketAddress
- Specified by:
getRemoteSocketAddressin interfaceEndPoint- Specified by:
getRemoteSocketAddressin classAbstractEndPoint- Returns:
- The remote SocketAddress to which this
EndPointis connected, ornullif thisEndPointis not connected to a Socket address.
-
receive
Description copied from interface:EndPointReceives data into the given buffer from the returned address.
This method should be used to receive UDP data.
- Parameters:
buffer- the buffer to fill with data- Returns:
- the peer address that sent the data, or
EndPoint.EOF - Throws:
IOException- if the receive fails
-
send
Description copied from interface:EndPointSends to the given address the data in the given buffers.
This methods should be used to send UDP data.
- Parameters:
address- the peer address to send data tobuffers- the buffers containing the data to send- Returns:
- true if all the buffers have been consumed
- Throws:
IOException- if the send fails- See Also:
-
write
public void write(Callback callback, SocketAddress address, ByteBuffer... buffers) throws WritePendingException Description copied from interface:EndPointWrites to the given address the data contained in the given buffers, and invokes the given callback when either all the data has been sent, or a failure occurs.
- Parameters:
callback- the callback to notify of the success or failure of the write operationaddress- the peer address to send data tobuffers- the buffers containing the data to send- Throws:
WritePendingException- if a previous write was initiated but was not yet completed- See Also:
-