Socket
Socket
Sign inDemoInstall

udp-streams2

Package Overview
Dependencies
0
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    udp-streams2

Writable stream implementation of dgram.send


Version published
Weekly downloads
17
increased by112.5%
Maintainers
1
Install size
12.7 kB
Created
Weekly downloads
 

Readme

Source

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.

FAQs

Last updated on 25 May 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc