Package org.eclipse.jetty.io
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 org.eclipse.jetty.io.EndPoint
EndPoint.Pipe, EndPoint.SslSessionData, EndPoint.Wrapper
-
Field Summary
-
Constructor Summary
ConstructorDescriptionDatagramChannelEndPoint
(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.boolean
send
(SocketAddress address, ByteBuffer... buffers) Sends to the given address the data in the given buffers.void
write
(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 org.eclipse.jetty.io.SelectableChannelEndPoint
doClose, getLocalSocketAddress, getTransport, isOpen, needsFillInterest, onClose, onIncompleteFlush, onSelected, replaceKey, toEndPointString, updateKey
Methods inherited from class org.eclipse.jetty.io.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, write
Methods inherited from class org.eclipse.jetty.io.IdleTimeout
checkIdleTimeout, getIdleFor, getIdleTimeout, getScheduler, notIdle, setIdleTimeout
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.eclipse.jetty.io.EndPoint
fill, flush, getIdleTimeout, getSslSessionData, isSecure, setIdleTimeout
-
Constructor Details
-
DatagramChannelEndPoint
public DatagramChannelEndPoint(DatagramChannel channel, ManagedSelector selector, SelectionKey key, Scheduler scheduler)
-
-
Method Details
-
getChannel
- Overrides:
getChannel
in classSelectableChannelEndPoint
-
getRemoteSocketAddress
- Specified by:
getRemoteSocketAddress
in interfaceEndPoint
- Specified by:
getRemoteSocketAddress
in classAbstractEndPoint
- Returns:
- The remote SocketAddress to which this
EndPoint
is connected, ornull
if thisEndPoint
is not connected to a Socket address.
-
receive
Description copied from interface:EndPoint
Receives 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:EndPoint
Sends 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:EndPoint
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.
- 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:
-