public class DatagramSocketImpl extends Object implements DatagramSocket, MetricsProvider
| Modifier and Type | Method and Description |
|---|---|
DatagramSocket |
blockMulticastGroup(String multicastAddress,
String sourceToBlock,
Handler<AsyncResult<DatagramSocket>> handler)
Block the given address for the given multicast address and notifies the
Handler once
the operation completes. |
DatagramSocket |
blockMulticastGroup(String multicastAddress,
String networkInterface,
String sourceToBlock,
Handler<AsyncResult<DatagramSocket>> handler)
Block the given address for the given multicast address on the given network interface and notifies
the
Handler once the operation completes. |
void |
close()
Closes the
DatagramSocket. |
void |
close(Handler<AsyncResult<Void>> handler)
Closes the
DatagramSocket implementation asynchronous
and notifies the handler once done. |
static DatagramSocketImpl |
create(VertxInternal vertx,
DatagramSocketOptions options) |
DatagramSocketImpl |
endHandler(Handler<Void> handler)
Set an end handler.
|
DatagramSocketImpl |
exceptionHandler(Handler<Throwable> handler)
Set an exception handler on the read stream.
|
DatagramSocket |
fetch(long amount)
Fetch the specified
amount of elements. |
protected void |
finalize() |
Metrics |
getMetrics()
Returns the metrics implementation.
|
DatagramSocket |
handler(Handler<DatagramPacket> handler)
Set a data handler.
|
boolean |
isMetricsEnabled()
Whether the metrics are enabled for this measured object
|
DatagramSocket |
listen(int port,
String address,
Handler<AsyncResult<DatagramSocket>> handler)
Start listening on the given port and host.
|
DatagramSocket |
listenMulticastGroup(String multicastAddress,
Handler<AsyncResult<DatagramSocket>> handler)
Joins a multicast group and listens for packets send to it.
|
DatagramSocket |
listenMulticastGroup(String multicastAddress,
String networkInterface,
String source,
Handler<AsyncResult<DatagramSocket>> handler)
Joins a multicast group and listens for packets send to it on the given network interface.
|
SocketAddress |
localAddress()
Return the
SocketAddress to which
this DatagramSocket is bound. |
DatagramSocket |
pause()
Pause the
ReadStream, it sets the buffer in fetch mode and clears the actual demand. |
DatagramSocket |
resume()
Resume reading, and sets the buffer in
flowing mode. |
DatagramSocket |
send(Buffer packet,
int port,
String host,
Handler<AsyncResult<DatagramSocket>> handler)
Write the given
Buffer to the SocketAddress. |
DatagramSocket |
send(String str,
int port,
String host,
Handler<AsyncResult<DatagramSocket>> handler)
Write the given
String to the SocketAddress using UTF8 encoding. |
DatagramSocket |
send(String str,
String enc,
int port,
String host,
Handler<AsyncResult<DatagramSocket>> handler)
Write the given
String to the SocketAddress using the given encoding. |
WriteStream<Buffer> |
sender(int port,
String host)
|
DatagramSocket |
unlistenMulticastGroup(String multicastAddress,
Handler<AsyncResult<DatagramSocket>> handler)
Leaves a multicast group and stops listening for packets send to it.
|
DatagramSocket |
unlistenMulticastGroup(String multicastAddress,
String networkInterface,
String source,
Handler<AsyncResult<DatagramSocket>> handler)
Leaves a multicast group and stops listening for packets send to it on the given network interface.
|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpipe, pipeTo, pipeTopublic static DatagramSocketImpl create(VertxInternal vertx, DatagramSocketOptions options)
public DatagramSocket listenMulticastGroup(String multicastAddress, Handler<AsyncResult<DatagramSocket>> handler)
DatagramSocketHandler is notified once the operation completes.listenMulticastGroup in interface DatagramSocketmulticastAddress - the address of the multicast group to joinhandler - then handler to notify once the operation completespublic DatagramSocket listenMulticastGroup(String multicastAddress, String networkInterface, String source, Handler<AsyncResult<DatagramSocket>> handler)
DatagramSocketHandler is notified once the operation completes.listenMulticastGroup in interface DatagramSocketmulticastAddress - the address of the multicast group to joinnetworkInterface - the network interface on which to listen for packets.source - the address of the source for which we will listen for multicast packetshandler - then handler to notify once the operation completespublic DatagramSocket unlistenMulticastGroup(String multicastAddress, Handler<AsyncResult<DatagramSocket>> handler)
DatagramSocketHandler is notified once the operation completes.unlistenMulticastGroup in interface DatagramSocketmulticastAddress - the address of the multicast group to leavehandler - then handler to notify once the operation completespublic DatagramSocket unlistenMulticastGroup(String multicastAddress, String networkInterface, String source, Handler<AsyncResult<DatagramSocket>> handler)
DatagramSocketHandler is notified once the operation completes.unlistenMulticastGroup in interface DatagramSocketmulticastAddress - the address of the multicast group to joinnetworkInterface - the network interface on which to listen for packets.source - the address of the source for which we will listen for multicast packetshandler - the handler to notify once the operation completespublic DatagramSocket blockMulticastGroup(String multicastAddress, String networkInterface, String sourceToBlock, Handler<AsyncResult<DatagramSocket>> handler)
DatagramSocketHandler once the operation completes.blockMulticastGroup in interface DatagramSocketmulticastAddress - the address for which you want to block the source addressnetworkInterface - the network interface on which the blocking should occur.sourceToBlock - the source address which should be blocked. You will not receive an multicast packets
for it anymore.handler - the handler to notify once the operation completespublic DatagramSocket blockMulticastGroup(String multicastAddress, String sourceToBlock, Handler<AsyncResult<DatagramSocket>> handler)
DatagramSocketHandler once
the operation completes.blockMulticastGroup in interface DatagramSocketmulticastAddress - the address for which you want to block the source addresssourceToBlock - the source address which should be blocked. You will not receive an multicast packets
for it anymore.handler - the handler to notify once the operation completespublic DatagramSocket listen(int port, String address, Handler<AsyncResult<DatagramSocket>> handler)
DatagramSocketlisten in interface DatagramSocketport - the port to listen onaddress - the host to listen onhandler - the handler will be called when listeningpublic DatagramSocket handler(Handler<DatagramPacket> handler)
ReadStreamhandler in interface DatagramSockethandler in interface ReadStream<DatagramPacket>public DatagramSocketImpl endHandler(Handler<Void> handler)
ReadStreamendHandler in interface DatagramSocketendHandler in interface ReadStream<DatagramPacket>public DatagramSocketImpl exceptionHandler(Handler<Throwable> handler)
ReadStreamexceptionHandler in interface DatagramSocketexceptionHandler in interface ReadStream<DatagramPacket>exceptionHandler in interface StreamBasehandler - the exception handlerpublic DatagramSocket pause()
ReadStreamReadStream, it sets the buffer in fetch mode and clears the actual demand.
While it's paused, no data will be sent to the data handler.
pause in interface DatagramSocketpause in interface ReadStream<DatagramPacket>public DatagramSocket resume()
ReadStreamflowing mode.
If the ReadStream has been paused, reading will recommence on it.resume in interface DatagramSocketresume in interface ReadStream<DatagramPacket>public DatagramSocket fetch(long amount)
ReadStreamamount of elements. If the ReadStream has been paused, reading will
recommence with the specified amount of items, otherwise the specified amount will
be added to the current stream demand.fetch in interface DatagramSocketfetch in interface ReadStream<DatagramPacket>public DatagramSocket send(Buffer packet, int port, String host, Handler<AsyncResult<DatagramSocket>> handler)
DatagramSocketsend in interface DatagramSocketpacket - the Buffer to writeport - the host port of the remote peerhost - the host address of the remote peerhandler - the Handler to notify once the write completes.public WriteStream<Buffer> sender(int port, String host)
DatagramSocketsender in interface DatagramSocketport - the port of the remote peerhost - the host address of the remote peerpublic DatagramSocket send(String str, int port, String host, Handler<AsyncResult<DatagramSocket>> handler)
DatagramSocketString to the SocketAddress using UTF8 encoding.
The Handler will be notified once the write completes.send in interface DatagramSocketstr - the String to writeport - the host port of the remote peerhost - the host address of the remote peerhandler - the Handler to notify once the write completes.public DatagramSocket send(String str, String enc, int port, String host, Handler<AsyncResult<DatagramSocket>> handler)
DatagramSocketString to the SocketAddress using the given encoding.
The Handler will be notified once the write completes.send in interface DatagramSocketstr - the String to writeenc - the charset used for encodingport - the host port of the remote peerhost - the host address of the remote peerhandler - the Handler to notify once the write completes.public SocketAddress localAddress()
DatagramSocketSocketAddress to which
this DatagramSocket is bound.localAddress in interface DatagramSocketpublic void close()
DatagramSocketDatagramSocket. The close itself is asynchronous.close in interface DatagramSocketpublic void close(Handler<AsyncResult<Void>> handler)
DatagramSocketDatagramSocket implementation asynchronous
and notifies the handler once done.close in interface DatagramSockethandler - the handler to notify once completepublic boolean isMetricsEnabled()
MeasuredisMetricsEnabled in interface Measuredtrue if metrics are enabledpublic Metrics getMetrics()
MetricsProvidergetMetrics in interface MetricsProviderCopyright © 2020. All rights reserved.