new DatagramSocket()
- Source:
Methods
blockMulticastGroup(multicastAddress, networkInterface, sourceToBlock, handler) → {DatagramSocket}
Block the given address for the given multicast address on the given network interface and notifies
the once the operation completes.
Parameters:
| Name | Type | Description |
|---|---|---|
multicastAddress |
string | the address for which you want to block the source address |
networkInterface |
string | the network interface on which the blocking should occur. |
sourceToBlock |
string | the source address which should be blocked. You will not receive an multicast packets for it anymore. |
handler |
function | the handler to notify once the operation completes |
- Source:
Returns:
a reference to this, so the API can be used fluently
- Type
- DatagramSocket
close(handler)
Closes the DatagramSocket implementation asynchronous
and notifies the handler once done.
Parameters:
| Name | Type | Description |
|---|---|---|
handler |
function | the handler to notify once complete |
- Source:
endHandler(endHandler) → {DatagramSocket}
Parameters:
| Name | Type | Description |
|---|---|---|
endHandler |
function |
- Source:
Returns:
- Type
- DatagramSocket
exceptionHandler(handler) → {DatagramSocket}
Parameters:
| Name | Type | Description |
|---|---|---|
handler |
function |
- Source:
Returns:
- Type
- DatagramSocket
fetch(amount) → {DatagramSocket}
Parameters:
| Name | Type | Description |
|---|---|---|
amount |
number |
- Source:
Returns:
- Type
- DatagramSocket
handler(handler) → {DatagramSocket}
Parameters:
| Name | Type | Description |
|---|---|---|
handler |
function |
- Source:
Returns:
- Type
- DatagramSocket
isMetricsEnabled() → {boolean}
Whether the metrics are enabled for this measured object
- Source:
Returns:
true if metrics are enabled
- Type
- boolean
listen(port, host, handler) → {DatagramSocket}
Start listening on the given port and host. The handler will be called when the socket is listening.
Parameters:
| Name | Type | Description |
|---|---|---|
port |
number | the port to listen on |
host |
string | the host to listen on |
handler |
function | the handler will be called when listening |
- Source:
Returns:
a reference to this, so the API can be used fluently
- Type
- DatagramSocket
listenMulticastGroup(multicastAddress, networkInterface, source, handler) → {DatagramSocket}
Joins a multicast group and listens for packets send to it on the given network interface.
The is notified once the operation completes.
Parameters:
| Name | Type | Description |
|---|---|---|
multicastAddress |
string | the address of the multicast group to join |
networkInterface |
string | the network interface on which to listen for packets. |
source |
string | the address of the source for which we will listen for multicast packets |
handler |
function | then handler to notify once the operation completes |
- Source:
Returns:
a reference to this, so the API can be used fluently
- Type
- DatagramSocket
localAddress() → {SocketAddress}
Return the SocketAddress to which
this DatagramSocket is bound.
- Source:
Returns:
the socket address
- Type
- SocketAddress
pause() → {DatagramSocket}
- Source:
Returns:
- Type
- DatagramSocket
pipe() → {Pipe}
Pause this stream and return a to transfer the elements of this stream to a destination .
The stream will be resumed when the pipe will be wired to a
WriteStream.
- Source:
Returns:
a pipe
- Type
- Pipe
pipeTo(dst, handler)
Pipe this
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.
Parameters:
| Name | Type | Description |
|---|---|---|
dst |
WriteStream | the destination write stream |
handler |
function |
- Source:
resume() → {DatagramSocket}
- Source:
Returns:
- Type
- DatagramSocket
send(str, enc, port, host, handler) → {DatagramSocket}
Write the given String to the SocketAddress using the given encoding.
The will be notified once the write completes.
Parameters:
| Name | Type | Description |
|---|---|---|
str |
string | the String to write |
enc |
string | the charset used for encoding |
port |
number | the host port of the remote peer |
host |
string | the host address of the remote peer |
handler |
function | the Handler to notify once the write completes. |
- Source:
Returns:
a reference to this, so the API can be used fluently
- Type
- DatagramSocket
sender(port, host) → {WriteStream}
Returns a
WriteStream able to send to the
SocketAddress.
Parameters:
| Name | Type | Description |
|---|---|---|
port |
number | the port of the remote peer |
host |
string | the host address of the remote peer |
- Source:
Returns:
the write stream for sending packets
- Type
- WriteStream
unlistenMulticastGroup(multicastAddress, networkInterface, source, handler) → {DatagramSocket}
Leaves a multicast group and stops listening for packets send to it on the given network interface.
The is notified once the operation completes.
Parameters:
| Name | Type | Description |
|---|---|---|
multicastAddress |
string | the address of the multicast group to join |
networkInterface |
string | the network interface on which to listen for packets. |
source |
string | the address of the source for which we will listen for multicast packets |
handler |
function | the handler to notify once the operation completes |
- Source:
Returns:
a reference to this, so the API can be used fluently
- Type
- DatagramSocket