npm

udp-streams2

1.1.0 • Public • Published

Udp-Streams2

This is a small wrapper around Node core's UDP (datagram) functionality providing a writable stream interface. There is currently no support for duplex/binding. It is written mostly to provide a consistent api for modules that support multiple transports.

Usage

var UdpStream = require('udp-streams2');
var client = new UdpStream();
client.connect({
	host: '127.0.0.1',
	port: 1234
}, function () {
	client.write('hello');
});

Or: var UdpStream = require('udp-streams2'); UdpStream.create({ host: '127.0.0.1, port: 1234 }, function (err, client) { client.write('hello'); });

While UDP socket creation is essentially synchronous, this module does perform DNS lookup in order to determine whether to create an IPv4 or an IPv6 instance (based on the resolved value). It also stores the resolved IP and sends directly to that, rather than performing a lookup every time. For these reasons, the API itself is asynchronous.

Tests

Clone, npm install, npm test.

Readme

Keywords

none

Package Sidebar

Install

npm i udp-streams2

Weekly Downloads

6

Version

1.1.0

License

ISC

Unpacked Size

12.1 kB

Total Files

4

Last publish

Collaborators

  • myndzi