Udp

Udp

new Udp(opts, adapter)

Source:

A transport for data that involves sending and receiving packets via UDP/Datagram

Parameters:
Name Type Description
opts Object

General settings for the Udp Transport

Properties
Name Type Attributes Description
protocol String

"udp4" or "udp6"

receiver Object <optional>

Setup an optional receiver

Properties
Name Type Description
port String

Port the receiver is listening on

protocol String

"udp4" or "udp6"

adapter Adapter

Adapter instance for which this is a transport.

Extends

Methods

close() → {Promise}

Source:

Close the listener

Returns:
Type
Promise

createSocketErrorHandler(socket)

Source:

Additional processing on UDP receiver socket errors. Currently, it closes and reopens the socket upon each error event until the max allowable error count threshold is reached

Parameters:
Name Type Description
socket Object

The UDP socket whose errors must be managed

init() → {Promise}

Source:

Setup the udp listener if one is configured

Returns:
Type
Promise

(private) received(data, rinfo)

Source:

Process incoming data

Parameters:
Name Type Description
data Buffer

The data buffer

rinfo Object

Info about the receiver

(private) receiver(port, protocol) → {Promise}

Source:

Configure the receiver

Parameters:
Name Type Description
port Number

The udp port to listen on

protocol String

"udp4" or "udp6"

Returns:
Type
Promise

send(address, command) → {Promise}

Source:
Overrides:

Send a command to the udp address

Parameters:
Name Type Description
address Object

The address the command will be sent to

command Command

The command to send

Returns:
Type
Promise

(private) write(data, port, host) → {Promise}

Source:

Write data to the UDP socket

Parameters:
Name Type Description
data Buffer

The data buffer

port Number

The destination port

host String

The destination IP address

Returns:

Resolves after the data in the Buffer has been written to the UDP socket

Type
Promise