Class DatagramSocket
- java.lang.Object
-
- io.vertx.mutiny.core.datagram.DatagramSocket
-
- All Implemented Interfaces:
Measured
,ReadStream<DatagramPacket>
,StreamBase
public class DatagramSocket extends Object implements ReadStream<DatagramPacket>, Measured
A datagram socket can be used to sendDatagramPacket
's to remote datagram servers and receiveDatagramPacket
s .Usually you use a datagram socket to send UDP over the wire. UDP is connection-less which means you are not connected to the remote peer in a persistent way. Because of this you have to supply the address and port of the remote peer when sending data.
You can send data to ipv4 or ipv6 addresses, which also include multicast addresses.
Please consult the documentation for more information on datagram sockets.
NOTE: This class has been automatically generated from theoriginal
non Mutiny-ified interface using Vert.x codegen.
-
-
Field Summary
Fields Modifier and Type Field Description static TypeArg<DatagramSocket>
__TYPE_ARG
-
Constructor Summary
Constructors Constructor Description DatagramSocket(io.vertx.core.datagram.DatagramSocket delegate)
DatagramSocket(Object delegate)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description io.smallrye.mutiny.Uni<Void>
blockMulticastGroup(String multicastAddress, String sourceToBlock)
Block the given address for the given multicast address and notifies the once the operation completes.io.smallrye.mutiny.Uni<Void>
blockMulticastGroup(String multicastAddress, String networkInterface, String sourceToBlock)
Block the given address for the given multicast address on the given network interface and notifies the once the operation completes.Void
blockMulticastGroupAndAwait(String multicastAddress, String sourceToBlock)
Blocking variant ofblockMulticastGroup(String,String)
.Void
blockMulticastGroupAndAwait(String multicastAddress, String networkInterface, String sourceToBlock)
Blocking variant ofblockMulticastGroup(String,String,String)
.DatagramSocket
blockMulticastGroupAndForget(String multicastAddress, String sourceToBlock)
Variant ofblockMulticastGroup(String,String)
that ignores the result of the operation.DatagramSocket
blockMulticastGroupAndForget(String multicastAddress, String networkInterface, String sourceToBlock)
Variant ofblockMulticastGroup(String,String,String)
that ignores the result of the operation.io.smallrye.mutiny.Uni<Void>
close()
Closes theDatagramSocket
implementation asynchronous and notifies the handler once done.Void
closeAndAwait()
Blocking variant ofclose()
.void
closeAndForget()
Variant ofclose()
that ignores the result of the operation.DatagramSocket
endHandler(Runnable endHandler)
boolean
equals(Object o)
DatagramSocket
exceptionHandler(Consumer<Throwable> handler)
DatagramSocket
fetch(long amount)
io.vertx.core.datagram.DatagramSocket
getDelegate()
DatagramSocket
handler(Consumer<DatagramPacket> handler)
int
hashCode()
boolean
isMetricsEnabled()
io.smallrye.mutiny.Uni<DatagramSocket>
listen(int port, String host)
Start listening on the given port and host.DatagramSocket
listenAndAwait(int port, String host)
Blocking variant oflisten(int,String)
.DatagramSocket
listenAndForget(int port, String host)
Variant oflisten(int,String)
that ignores the result of the operation.io.smallrye.mutiny.Uni<Void>
listenMulticastGroup(String multicastAddress)
Joins a multicast group and listens for packets send to it.io.smallrye.mutiny.Uni<Void>
listenMulticastGroup(String multicastAddress, String networkInterface, String source)
Joins a multicast group and listens for packets send to it on the given network interface.Void
listenMulticastGroupAndAwait(String multicastAddress)
Blocking variant oflistenMulticastGroup(String)
.Void
listenMulticastGroupAndAwait(String multicastAddress, String networkInterface, String source)
Blocking variant oflistenMulticastGroup(String,String,String)
.DatagramSocket
listenMulticastGroupAndForget(String multicastAddress)
Variant oflistenMulticastGroup(String)
that ignores the result of the operation.DatagramSocket
listenMulticastGroupAndForget(String multicastAddress, String networkInterface, String source)
Variant oflistenMulticastGroup(String,String,String)
that ignores the result of the operation.SocketAddress
localAddress()
static DatagramSocket
newInstance(io.vertx.core.datagram.DatagramSocket arg)
DatagramSocket
pause()
Pipe<DatagramPacket>
pipe()
io.smallrye.mutiny.Uni<Void>
pipeTo(WriteStream<DatagramPacket> dst)
Pipe thisReadStream
to theWriteStream
.Void
pipeToAndAwait(WriteStream<DatagramPacket> dst)
Blocking variant ofReadStream.pipeTo(io.vertx.mutiny.core.streams.WriteStream)
.void
pipeToAndForget(WriteStream<DatagramPacket> dst)
Variant ofReadStream.pipeTo(io.vertx.mutiny.core.streams.WriteStream)
that ignores the result of the operation.DatagramSocket
resume()
io.smallrye.mutiny.Uni<Void>
send(Buffer packet, int port, String host)
Write the givenBuffer
to theSocketAddress
.io.smallrye.mutiny.Uni<Void>
send(String str, int port, String host)
Write the givenString
to theSocketAddress
using UTF8 encoding.io.smallrye.mutiny.Uni<Void>
send(String str, String enc, int port, String host)
Write the givenString
to theSocketAddress
using the given encoding.Void
sendAndAwait(Buffer packet, int port, String host)
Blocking variant ofsend(io.vertx.mutiny.core.buffer.Buffer,int,String)
.Void
sendAndAwait(String str, int port, String host)
Blocking variant ofsend(String,int,String)
.Void
sendAndAwait(String str, String enc, int port, String host)
Blocking variant ofsend(String,String,int,String)
.DatagramSocket
sendAndForget(Buffer packet, int port, String host)
Variant ofsend(io.vertx.mutiny.core.buffer.Buffer,int,String)
that ignores the result of the operation.DatagramSocket
sendAndForget(String str, int port, String host)
Variant ofsend(String,int,String)
that ignores the result of the operation.DatagramSocket
sendAndForget(String str, String enc, int port, String host)
Variant ofsend(String,String,int,String)
that ignores the result of the operation.WriteStream<Buffer>
sender(int port, String host)
Iterable<DatagramPacket>
toBlockingIterable()
Stream<DatagramPacket>
toBlockingStream()
io.smallrye.mutiny.Multi<DatagramPacket>
toMulti()
String
toString()
io.smallrye.mutiny.Uni<Void>
unlistenMulticastGroup(String multicastAddress)
Leaves a multicast group and stops listening for packets send to it.io.smallrye.mutiny.Uni<Void>
unlistenMulticastGroup(String multicastAddress, String networkInterface, String source)
Leaves a multicast group and stops listening for packets send to it on the given network interface.Void
unlistenMulticastGroupAndAwait(String multicastAddress)
Blocking variant ofunlistenMulticastGroup(String)
.Void
unlistenMulticastGroupAndAwait(String multicastAddress, String networkInterface, String source)
Blocking variant ofunlistenMulticastGroup(String,String,String)
.DatagramSocket
unlistenMulticastGroupAndForget(String multicastAddress)
Variant ofunlistenMulticastGroup(String)
that ignores the result of the operation.DatagramSocket
unlistenMulticastGroupAndForget(String multicastAddress, String networkInterface, String source)
Variant ofunlistenMulticastGroup(String,String,String)
that ignores the result of the operation.
-
-
-
Field Detail
-
__TYPE_ARG
public static final TypeArg<DatagramSocket> __TYPE_ARG
-
-
Constructor Detail
-
DatagramSocket
public DatagramSocket(io.vertx.core.datagram.DatagramSocket delegate)
-
DatagramSocket
public DatagramSocket(Object delegate)
-
-
Method Detail
-
getDelegate
public io.vertx.core.datagram.DatagramSocket getDelegate()
- Specified by:
getDelegate
in interfaceMeasured
- Specified by:
getDelegate
in interfaceReadStream<DatagramPacket>
- Specified by:
getDelegate
in interfaceStreamBase
-
isMetricsEnabled
public boolean isMetricsEnabled()
- Specified by:
isMetricsEnabled
in interfaceMeasured
- Returns:
true
if metrics are enabled
-
pipe
public Pipe<DatagramPacket> pipe()
- Specified by:
pipe
in interfaceReadStream<DatagramPacket>
- Returns:
- a pipe
-
pipeTo
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> pipeTo(WriteStream<DatagramPacket> dst)
Pipe thisReadStream
to theWriteStream
.Elements emitted by this stream will be written to the write stream until this stream ends or fails.
Once this stream has ended or failed, the write stream will be ended and the
handler
will be called with the result.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Specified by:
pipeTo
in interfaceReadStream<DatagramPacket>
- Parameters:
dst
- the destination write stream- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
pipeToAndAwait
public Void pipeToAndAwait(WriteStream<DatagramPacket> dst)
Blocking variant ofReadStream.pipeTo(io.vertx.mutiny.core.streams.WriteStream)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Specified by:
pipeToAndAwait
in interfaceReadStream<DatagramPacket>
- Parameters:
dst
- the destination write stream- Returns:
- the Void instance produced by the operation.
-
pipeToAndForget
public void pipeToAndForget(WriteStream<DatagramPacket> dst)
Variant ofReadStream.pipeTo(io.vertx.mutiny.core.streams.WriteStream)
that ignores the result of the operation.This method subscribes on the result of
ReadStream.pipeTo(io.vertx.mutiny.core.streams.WriteStream)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromReadStream.pipeTo(io.vertx.mutiny.core.streams.WriteStream)
but you don't need to compose it with other operations.- Specified by:
pipeToAndForget
in interfaceReadStream<DatagramPacket>
- Parameters:
dst
- the destination write stream
-
send
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> send(Buffer packet, int port, String host)
Write the givenBuffer
to theSocketAddress
. TheHandler
will be notified once the write completes.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
packet
- theBuffer
to writeport
- the host port of the remote peerhost
- the host address of the remote peer- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
sendAndAwait
public Void sendAndAwait(Buffer packet, int port, String host)
Blocking variant ofsend(io.vertx.mutiny.core.buffer.Buffer,int,String)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
packet
- theBuffer
to writeport
- the host port of the remote peerhost
- the host address of the remote peer- Returns:
- the Void instance produced by the operation.
-
sendAndForget
public DatagramSocket sendAndForget(Buffer packet, int port, String host)
Variant ofsend(io.vertx.mutiny.core.buffer.Buffer,int,String)
that ignores the result of the operation.This method subscribes on the result of
send(io.vertx.mutiny.core.buffer.Buffer,int,String)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromsend(io.vertx.mutiny.core.buffer.Buffer,int,String)
but you don't need to compose it with other operations.- Parameters:
packet
- theBuffer
to writeport
- the host port of the remote peerhost
- the host address of the remote peer- Returns:
- the instance of DatagramSocket to chain method calls.
-
sender
public WriteStream<Buffer> sender(int port, String host)
- Parameters:
port
- the port of the remote peerhost
- the host address of the remote peer- Returns:
- the write stream for sending packets
-
send
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> send(String str, int port, String host)
Write the givenString
to theSocketAddress
using UTF8 encoding. The will be notified once the write completes.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
str
- theString
to writeport
- the host port of the remote peerhost
- the host address of the remote peer- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
sendAndAwait
public Void sendAndAwait(String str, int port, String host)
Blocking variant ofsend(String,int,String)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
str
- theString
to writeport
- the host port of the remote peerhost
- the host address of the remote peer- Returns:
- the Void instance produced by the operation.
-
sendAndForget
public DatagramSocket sendAndForget(String str, int port, String host)
Variant ofsend(String,int,String)
that ignores the result of the operation.This method subscribes on the result of
send(String,int,String)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromsend(String,int,String)
but you don't need to compose it with other operations.- Parameters:
str
- theString
to writeport
- the host port of the remote peerhost
- the host address of the remote peer- Returns:
- the instance of DatagramSocket to chain method calls.
-
send
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> send(String str, String enc, int port, String host)
Write the givenString
to theSocketAddress
using the given encoding. The will be notified once the write completes.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
str
- theString
to writeenc
- the charset used for encodingport
- the host port of the remote peerhost
- the host address of the remote peer- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
sendAndAwait
public Void sendAndAwait(String str, String enc, int port, String host)
Blocking variant ofsend(String,String,int,String)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
str
- theString
to writeenc
- the charset used for encodingport
- the host port of the remote peerhost
- the host address of the remote peer- Returns:
- the Void instance produced by the operation.
-
sendAndForget
public DatagramSocket sendAndForget(String str, String enc, int port, String host)
Variant ofsend(String,String,int,String)
that ignores the result of the operation.This method subscribes on the result of
send(String,String,int,String)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromsend(String,String,int,String)
but you don't need to compose it with other operations.- Parameters:
str
- theString
to writeenc
- the charset used for encodingport
- the host port of the remote peerhost
- the host address of the remote peer- Returns:
- the instance of DatagramSocket to chain method calls.
-
close
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> close()
Closes theDatagramSocket
implementation asynchronous and notifies the handler once done.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
closeAndAwait
public Void closeAndAwait()
Blocking variant ofclose()
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Returns:
- the Void instance produced by the operation.
-
closeAndForget
public void closeAndForget()
-
localAddress
public SocketAddress localAddress()
- Returns:
- the socket address
-
listenMulticastGroup
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> listenMulticastGroup(String multicastAddress)
Joins a multicast group and listens for packets send to it. The is notified once the operation completes.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
multicastAddress
- the address of the multicast group to join- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
listenMulticastGroupAndAwait
public Void listenMulticastGroupAndAwait(String multicastAddress)
Blocking variant oflistenMulticastGroup(String)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
multicastAddress
- the address of the multicast group to join- Returns:
- the Void instance produced by the operation.
-
listenMulticastGroupAndForget
public DatagramSocket listenMulticastGroupAndForget(String multicastAddress)
Variant oflistenMulticastGroup(String)
that ignores the result of the operation.This method subscribes on the result of
listenMulticastGroup(String)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromlistenMulticastGroup(String)
but you don't need to compose it with other operations.- Parameters:
multicastAddress
- the address of the multicast group to join- Returns:
- the instance of DatagramSocket to chain method calls.
-
listenMulticastGroup
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> listenMulticastGroup(String multicastAddress, String networkInterface, String source)
Joins a multicast group and listens for packets send to it on the given network interface. The is notified once the operation completes.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
multicastAddress
- 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 packets- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
listenMulticastGroupAndAwait
public Void listenMulticastGroupAndAwait(String multicastAddress, String networkInterface, String source)
Blocking variant oflistenMulticastGroup(String,String,String)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
multicastAddress
- 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 packets- Returns:
- the Void instance produced by the operation.
-
listenMulticastGroupAndForget
public DatagramSocket listenMulticastGroupAndForget(String multicastAddress, String networkInterface, String source)
Variant oflistenMulticastGroup(String,String,String)
that ignores the result of the operation.This method subscribes on the result of
listenMulticastGroup(String,String,String)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromlistenMulticastGroup(String,String,String)
but you don't need to compose it with other operations.- Parameters:
multicastAddress
- 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 packets- Returns:
- the instance of DatagramSocket to chain method calls.
-
unlistenMulticastGroup
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> unlistenMulticastGroup(String multicastAddress)
Leaves a multicast group and stops listening for packets send to it. The is notified once the operation completes.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
multicastAddress
- the address of the multicast group to leave- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
unlistenMulticastGroupAndAwait
public Void unlistenMulticastGroupAndAwait(String multicastAddress)
Blocking variant ofunlistenMulticastGroup(String)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
multicastAddress
- the address of the multicast group to leave- Returns:
- the Void instance produced by the operation.
-
unlistenMulticastGroupAndForget
public DatagramSocket unlistenMulticastGroupAndForget(String multicastAddress)
Variant ofunlistenMulticastGroup(String)
that ignores the result of the operation.This method subscribes on the result of
unlistenMulticastGroup(String)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromunlistenMulticastGroup(String)
but you don't need to compose it with other operations.- Parameters:
multicastAddress
- the address of the multicast group to leave- Returns:
- the instance of DatagramSocket to chain method calls.
-
unlistenMulticastGroup
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> unlistenMulticastGroup(String multicastAddress, String networkInterface, String source)
Leaves a multicast group and stops listening for packets send to it on the given network interface. The is notified once the operation completes.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
multicastAddress
- 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 packets- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
unlistenMulticastGroupAndAwait
public Void unlistenMulticastGroupAndAwait(String multicastAddress, String networkInterface, String source)
Blocking variant ofunlistenMulticastGroup(String,String,String)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
multicastAddress
- 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 packets- Returns:
- the Void instance produced by the operation.
-
unlistenMulticastGroupAndForget
public DatagramSocket unlistenMulticastGroupAndForget(String multicastAddress, String networkInterface, String source)
Variant ofunlistenMulticastGroup(String,String,String)
that ignores the result of the operation.This method subscribes on the result of
unlistenMulticastGroup(String,String,String)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromunlistenMulticastGroup(String,String,String)
but you don't need to compose it with other operations.- Parameters:
multicastAddress
- 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 packets- Returns:
- the instance of DatagramSocket to chain method calls.
-
blockMulticastGroup
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> blockMulticastGroup(String multicastAddress, String sourceToBlock)
Block the given address for the given multicast address and notifies the once the operation completes.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
multicastAddress
- 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.- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
blockMulticastGroupAndAwait
public Void blockMulticastGroupAndAwait(String multicastAddress, String sourceToBlock)
Blocking variant ofblockMulticastGroup(String,String)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
multicastAddress
- 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.- Returns:
- the Void instance produced by the operation.
-
blockMulticastGroupAndForget
public DatagramSocket blockMulticastGroupAndForget(String multicastAddress, String sourceToBlock)
Variant ofblockMulticastGroup(String,String)
that ignores the result of the operation.This method subscribes on the result of
blockMulticastGroup(String,String)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromblockMulticastGroup(String,String)
but you don't need to compose it with other operations.- Parameters:
multicastAddress
- 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.- Returns:
- the instance of DatagramSocket to chain method calls.
-
blockMulticastGroup
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> blockMulticastGroup(String multicastAddress, String networkInterface, String sourceToBlock)
Block the given address for the given multicast address on the given network interface and notifies the once the operation completes.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
multicastAddress
- 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.- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
blockMulticastGroupAndAwait
public Void blockMulticastGroupAndAwait(String multicastAddress, String networkInterface, String sourceToBlock)
Blocking variant ofblockMulticastGroup(String,String,String)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
multicastAddress
- 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.- Returns:
- the Void instance produced by the operation.
-
blockMulticastGroupAndForget
public DatagramSocket blockMulticastGroupAndForget(String multicastAddress, String networkInterface, String sourceToBlock)
Variant ofblockMulticastGroup(String,String,String)
that ignores the result of the operation.This method subscribes on the result of
blockMulticastGroup(String,String,String)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromblockMulticastGroup(String,String,String)
but you don't need to compose it with other operations.- Parameters:
multicastAddress
- 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.- Returns:
- the instance of DatagramSocket to chain method calls.
-
listen
@CheckReturnValue public io.smallrye.mutiny.Uni<DatagramSocket> listen(int port, String host)
Start listening on the given port and host. The handler will be called when the socket is listening.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
port
- the port to listen onhost
- the host to listen on- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
listenAndAwait
public DatagramSocket listenAndAwait(int port, String host)
Blocking variant oflisten(int,String)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
port
- the port to listen onhost
- the host to listen on- Returns:
- the DatagramSocket instance produced by the operation.
-
listenAndForget
public DatagramSocket listenAndForget(int port, String host)
Variant oflisten(int,String)
that ignores the result of the operation.This method subscribes on the result of
listen(int,String)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromlisten(int,String)
but you don't need to compose it with other operations.- Parameters:
port
- the port to listen onhost
- the host to listen on- Returns:
- the instance of DatagramSocket to chain method calls.
-
pause
public DatagramSocket pause()
- Specified by:
pause
in interfaceReadStream<DatagramPacket>
- Returns:
- a reference to this, so the API can be used fluently
-
resume
public DatagramSocket resume()
- Specified by:
resume
in interfaceReadStream<DatagramPacket>
- Returns:
- a reference to this, so the API can be used fluently
-
fetch
public DatagramSocket fetch(long amount)
- Specified by:
fetch
in interfaceReadStream<DatagramPacket>
- Returns:
- a reference to this, so the API can be used fluently
-
endHandler
public DatagramSocket endHandler(Runnable endHandler)
- Specified by:
endHandler
in interfaceReadStream<DatagramPacket>
- Returns:
-
handler
public DatagramSocket handler(Consumer<DatagramPacket> handler)
- Specified by:
handler
in interfaceReadStream<DatagramPacket>
- Returns:
-
exceptionHandler
public DatagramSocket exceptionHandler(Consumer<Throwable> handler)
- Specified by:
exceptionHandler
in interfaceReadStream<DatagramPacket>
- Specified by:
exceptionHandler
in interfaceStreamBase
- Parameters:
handler
- the exception handler- Returns:
-
toMulti
@CheckReturnValue public io.smallrye.mutiny.Multi<DatagramPacket> toMulti()
- Specified by:
toMulti
in interfaceReadStream<DatagramPacket>
-
toBlockingIterable
public Iterable<DatagramPacket> toBlockingIterable()
-
toBlockingStream
public Stream<DatagramPacket> toBlockingStream()
-
newInstance
public static DatagramSocket newInstance(io.vertx.core.datagram.DatagramSocket arg)
-
-