A datagram socket can be used to send @see \io\vertx\jphp\core\datagram\DatagramPacket's to remote datagram servers and receive @see \io\vertx\jphp\core\datagram\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.
package |
Default |
---|
__construct()
blockMulticastGroup( $arg0, $arg1, $arg2, $arg3 = null) : $this
param $multicastAddress [string] the address for which you want to block the source address param $sourceToBlock [string] the source address which should be blocked. You will not receive an multicast packets for it anymore. param $handler [callable] the handler to notify once the operation completes blockMulticastGroup($multicastAddress, $sourceToBlock, $handler)
Block the given address for the given multicast address on the given network interface and notifies the once the operation completes.
param $multicastAddress [string] the address for which you want to block the source address param $networkInterface [string] the network interface on which the blocking should occur. param $sourceToBlock [string] the source address which should be blocked. You will not receive an multicast packets for it anymore. param $handler [callable] the handler to notify once the operation completes blockMulticastGroup($multicastAddress, $networkInterface, $sourceToBlock, $handler)
string
string
callable | string
callable
$this
a reference to this, so the API can be used fluently
close( $arg0 = null) : void
close()
Closes the @see \io\vertx\jphp\core\datagram\DatagramSocket implementation asynchronous and notifies the handler once done.
param $handler [callable] the handler to notify once complete close($handler)
callable
endHandler( $arg0) : $this
callable
$this
exceptionHandler( $arg0) : $this
callable
$this
fetch( $arg0) : $this
integer
$this
handler( $arg0) : $this
callable
$this
isMetricsEnabled() : boolean
boolean
{@code true} if metrics are enabled
listen( $arg0, $arg1, $arg2) : $this
integer
string
callable
$this
a reference to this, so the API can be used fluently
listenMulticastGroup( $arg0, $arg1, $arg2 = null, $arg3 = null) : $this
The is notified once the operation completes.
param $multicastAddress [string] the address of the multicast group to join param $handler [callable] then handler to notify once the operation completes listenMulticastGroup($multicastAddress, $handler)
Joins a multicast group and listens for packets send to it on the given network interface. The is notified once the operation completes.
param $multicastAddress [string] the address of the multicast group to join param $networkInterface [string] the network interface on which to listen for packets. param $source [string] the address of the source for which we will listen for multicast packets param $handler [callable] then handler to notify once the operation completes listenMulticastGroup($multicastAddress, $networkInterface, $source, $handler)
string
callable | string
string
callable
$this
a reference to this, so the API can be used fluently
localAddress() : \io\vertx\jphp\core\net\SocketAddress
pause() : $this
$this
resume() : $this
$this
send( $arg0, $arg1, $arg2, $arg3, $arg4 = null) : $this
The \io.vertx.core.Handler will be notified once the write completes.
param $packet [Buffer] the \io.vertx.core.buffer.Buffer to write param $port [integer] the host port of the remote peer param $host [string] the host address of the remote peer param $handler [callable] the \io.vertx.core.Handler to notify once the write completes. send($packet, $port, $host, $handler)
Write the given \java.lang.String to the @see \io\vertx\jphp\core\net\SocketAddress using UTF8 encoding. The will be notified once the write completes.
param $str [string] the String to write param $port [integer] the host port of the remote peer param $host [string] the host address of the remote peer param $handler [callable] the \io.vertx.core.Handler to notify once the write completes. send($str, $port, $host, $handler)
Write the given \java.lang.String to the @see \io\vertx\jphp\core\net\SocketAddress using the given encoding. The will be notified once the write completes.
param $str [string] the String to write param $enc [string] the charset used for encoding param $port [integer] the host port of the remote peer param $host [string] the host address of the remote peer param $handler [callable] the \io.vertx.core.Handler to notify once the write completes. send($str, $enc, $port, $host, $handler)
Buffer | string
string | integer
string | integer
callable | string
callable
$this
a reference to this, so the API can be used fluently
sender( $arg0, $arg1) : \io\vertx\jphp\core\datagram\WriteStream<Buffer>
see | \io\vertx\jphp\core\net\SocketAddress. |
---|
integer
string
\io\vertx\jphp\core\datagram\WriteStream
the write stream for sending packets
unlistenMulticastGroup( $arg0, $arg1, $arg2 = null, $arg3 = null) : $this
The is notified once the operation completes.
param $multicastAddress [string] the address of the multicast group to leave param $handler [callable] then handler to notify once the operation completes unlistenMulticastGroup($multicastAddress, $handler)
Leaves a multicast group and stops listening for packets send to it on the given network interface. The is notified once the operation completes.
param $multicastAddress [string] the address of the multicast group to join param $networkInterface [string] the network interface on which to listen for packets. param $source [string] the address of the source for which we will listen for multicast packets param $handler [callable] the handler to notify once the operation completes unlistenMulticastGroup($multicastAddress, $networkInterface, $source, $handler)
string
callable | string
string
callable
$this
a reference to this, so the API can be used fluently