public class DatagramSocket extends Object implements ReadStream<DatagramPacket>, Measured
DatagramPacket's to remote datagram servers
and receive DatagramPackets .
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 RX-ified interface using Vert.x codegen.| Modifier and Type | Field and Description |
|---|---|
static io.vertx.lang.rx.TypeArg<DatagramSocket> |
__TYPE_ARG |
| Constructor and Description |
|---|
DatagramSocket(DatagramSocket delegate) |
DatagramSocket(Object delegate) |
| Modifier and Type | Method and Description |
|---|---|
Completable |
blockMulticastGroup(String multicastAddress,
String sourceToBlock)
Block the given address for the given multicast address and notifies the once
the operation completes.
|
Completable |
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.
|
Completable |
close()
Closes the
DatagramSocket implementation asynchronous
and notifies the handler once done. |
DatagramSocket |
endHandler(Handler<Void> endHandler)
Set an end handler.
|
boolean |
equals(Object o) |
DatagramSocket |
exceptionHandler(Handler<Throwable> handler)
Set an exception handler on the read stream.
|
DatagramSocket |
fetch(long amount)
Fetch the specified
amount of elements. |
DatagramSocket |
getDelegate() |
DatagramSocket |
handler(Handler<DatagramPacket> handler)
Set a data handler.
|
int |
hashCode() |
boolean |
isMetricsEnabled()
Whether the metrics are enabled for this measured object
|
Single<DatagramSocket> |
listen(int port,
String host)
Start listening on the given port and host.
|
Completable |
listenMulticastGroup(String multicastAddress)
Joins a multicast group and listens for packets send to it.
|
Completable |
listenMulticastGroup(String multicastAddress,
String networkInterface,
String source)
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. |
static DatagramSocket |
newInstance(DatagramSocket arg) |
DatagramSocket |
pause()
Pause the
ReadStream, it sets the buffer in fetch mode and clears the actual demand. |
Pipe<DatagramPacket> |
pipe()
Pause this stream and return a to transfer the elements of this stream to a destination .
|
Completable |
pipeTo(WriteStream<DatagramPacket> dst)
Pipe this
ReadStream to the WriteStream. |
DatagramSocket |
resume()
Resume reading, and sets the buffer in
flowing mode. |
Completable |
rxBlockMulticastGroup(String multicastAddress,
String sourceToBlock)
Block the given address for the given multicast address and notifies the once
the operation completes.
|
Completable |
rxBlockMulticastGroup(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.
|
Completable |
rxClose()
Closes the
DatagramSocket implementation asynchronous
and notifies the handler once done. |
Single<DatagramSocket> |
rxListen(int port,
String host)
Start listening on the given port and host.
|
Completable |
rxListenMulticastGroup(String multicastAddress)
Joins a multicast group and listens for packets send to it.
|
Completable |
rxListenMulticastGroup(String multicastAddress,
String networkInterface,
String source)
Joins a multicast group and listens for packets send to it on the given network interface.
|
Completable |
rxPipeTo(WriteStream<DatagramPacket> dst)
Pipe this
ReadStream to the WriteStream. |
Completable |
rxSend(Buffer packet,
int port,
String host)
Write the given
Buffer to the SocketAddress. |
Completable |
rxSend(String str,
int port,
String host)
Write the given
String to the SocketAddress using UTF8 encoding. |
Completable |
rxSend(String str,
String enc,
int port,
String host)
Write the given
String to the SocketAddress using the given encoding. |
Completable |
rxUnlistenMulticastGroup(String multicastAddress)
Leaves a multicast group and stops listening for packets send to it.
|
Completable |
rxUnlistenMulticastGroup(String multicastAddress,
String networkInterface,
String source)
Leaves a multicast group and stops listening for packets send to it on the given network interface.
|
Completable |
send(Buffer packet,
int port,
String host)
Write the given
Buffer to the SocketAddress. |
Completable |
send(String str,
int port,
String host)
Write the given
String to the SocketAddress using UTF8 encoding. |
Completable |
send(String str,
String enc,
int port,
String host)
Write the given
String to the SocketAddress using the given encoding. |
WriteStream<Buffer> |
sender(int port,
String host)
Returns a
WriteStream able to send to the
SocketAddress. |
Flowable<DatagramPacket> |
toFlowable() |
Observable<DatagramPacket> |
toObservable() |
String |
toString() |
Completable |
unlistenMulticastGroup(String multicastAddress)
Leaves a multicast group and stops listening for packets send to it.
|
Completable |
unlistenMulticastGroup(String multicastAddress,
String networkInterface,
String source)
Leaves a multicast group and stops listening for packets send to it on the given network interface.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, waitnewInstance, newInstancenewInstancenewInstancepublic static final io.vertx.lang.rx.TypeArg<DatagramSocket> __TYPE_ARG
public DatagramSocket(DatagramSocket delegate)
public DatagramSocket(Object delegate)
public DatagramSocket getDelegate()
getDelegate in interface MeasuredgetDelegate in interface ReadStream<DatagramPacket>getDelegate in interface StreamBasepublic Observable<DatagramPacket> toObservable()
toObservable in interface ReadStream<DatagramPacket>public Flowable<DatagramPacket> toFlowable()
toFlowable in interface ReadStream<DatagramPacket>public boolean isMetricsEnabled()
isMetricsEnabled in interface Measuredtrue if metrics are enabledpublic Pipe<DatagramPacket> pipe()
WriteStream.pipe in interface ReadStream<DatagramPacket>public Completable pipeTo(WriteStream<DatagramPacket> dst)
ReadStream to the WriteStream.
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.
pipeTo in interface ReadStream<DatagramPacket>dst - the destination write streampublic Completable rxPipeTo(WriteStream<DatagramPacket> dst)
ReadStream to the WriteStream.
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.
rxPipeTo in interface ReadStream<DatagramPacket>dst - the destination write streampublic Completable send(Buffer packet, int port, String host)
packet - the Buffer to writeport - the host port of the remote peerhost - the host address of the remote peerpublic Completable rxSend(Buffer packet, int port, String host)
packet - the Buffer to writeport - the host port of the remote peerhost - the host address of the remote peerpublic WriteStream<Buffer> sender(int port, String host)
WriteStream able to send to the
SocketAddress.port - the port of the remote peerhost - the host address of the remote peerpublic Completable send(String str, int port, String host)
String to the SocketAddress using UTF8 encoding.
The will be notified once the write completes.str - the String to writeport - the host port of the remote peerhost - the host address of the remote peerpublic Completable rxSend(String str, int port, String host)
String to the SocketAddress using UTF8 encoding.
The will be notified once the write completes.str - the String to writeport - the host port of the remote peerhost - the host address of the remote peerpublic Completable send(String str, String enc, int port, String host)
String to the SocketAddress using the given encoding.
The will be notified once the write completes.str - the String to writeenc - the charset used for encodingport - the host port of the remote peerhost - the host address of the remote peerpublic Completable rxSend(String str, String enc, int port, String host)
String to the SocketAddress using the given encoding.
The will be notified once the write completes.str - the String to writeenc - the charset used for encodingport - the host port of the remote peerhost - the host address of the remote peerpublic Completable close()
DatagramSocket implementation asynchronous
and notifies the handler once done.public Completable rxClose()
DatagramSocket implementation asynchronous
and notifies the handler once done.public SocketAddress localAddress()
SocketAddress to which
this DatagramSocket is bound.public Completable listenMulticastGroup(String multicastAddress)
multicastAddress - the address of the multicast group to joinpublic Completable rxListenMulticastGroup(String multicastAddress)
multicastAddress - the address of the multicast group to joinpublic Completable listenMulticastGroup(String multicastAddress, String networkInterface, String source)
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 packetspublic Completable rxListenMulticastGroup(String multicastAddress, String networkInterface, String source)
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 packetspublic Completable unlistenMulticastGroup(String multicastAddress)
multicastAddress - the address of the multicast group to leavepublic Completable rxUnlistenMulticastGroup(String multicastAddress)
multicastAddress - the address of the multicast group to leavepublic Completable unlistenMulticastGroup(String multicastAddress, String networkInterface, String source)
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 packetspublic Completable rxUnlistenMulticastGroup(String multicastAddress, String networkInterface, String source)
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 packetspublic Completable blockMulticastGroup(String multicastAddress, String sourceToBlock)
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.public Completable rxBlockMulticastGroup(String multicastAddress, String sourceToBlock)
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.public Completable blockMulticastGroup(String multicastAddress, String networkInterface, String sourceToBlock)
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.public Completable rxBlockMulticastGroup(String multicastAddress, String networkInterface, String sourceToBlock)
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.public Single<DatagramSocket> listen(int port, String host)
port - the port to listen onhost - the host to listen onpublic Single<DatagramSocket> rxListen(int port, String host)
port - the port to listen onhost - the host to listen onpublic 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 ReadStream<DatagramPacket>public DatagramSocket resume()
ReadStreamflowing mode.
If the ReadStream has been paused, reading will recommence on it.resume 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 ReadStream<DatagramPacket>public DatagramSocket endHandler(Handler<Void> endHandler)
ReadStreamendHandler in interface ReadStream<DatagramPacket>public DatagramSocket handler(Handler<DatagramPacket> handler)
ReadStreamhandler in interface ReadStream<DatagramPacket>public DatagramSocket exceptionHandler(Handler<Throwable> handler)
ReadStreamexceptionHandler in interface ReadStream<DatagramPacket>exceptionHandler in interface StreamBasehandler - the exception handlerpublic static DatagramSocket newInstance(DatagramSocket arg)
Copyright © 2023 Eclipse. All rights reserved.