Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

datagram-stream

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

datagram-stream

Streaming UDP with broadcast, multicast and unicast options

  • 1.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.1K
decreased by-48.49%
Maintainers
1
Weekly downloads
 
Created
Source

datagram-stream

Build Status

A streaming UDP module with broadcast, multicast and unicast options.

install

npm install datagram-stream

usage

multicast

var udp = require('datagram-stream');

var stream = udp({
    address     : '0.0.0.0'   //address to bind to
    , multicast : '239.5.5.5' //multicast ip address to send to and listen on
    , port      : 5555        //udp port to send to
    , bindingPort : 5556      //udp port to listen on. Default: port
    , reuseAddr : true        //boolean: allow multiple processes to bind to the
                              //         same address and port. Default: true
    , loopback  : true        //boolean: whether or not to receive sent datagrams
                              //         on the loopback device. Only applies to
                              //         multicast. Default: false
});

//pipe whatever is received to stdout
stream.pipe(process.stdout);

//pipe whatever is received on stdin over udp
process.stdin.pipe(stream);

broadcast

var udp = require('datagram-stream');

var stream = udp({
    address     : '0.0.0.0'         //address to bind to
    , broadcast : '255.255.255.255' //broadcast ip address to send to
    , port      : 5555              //udp port to send to
    , bindingPort : 5556            //udp port to listen on. Default: port
    , reuseAddr : true              //boolean: allow multiple processes to bind to the
                                    //         same address and port. Default: true
 });

//pipe whatever is received to stdout
stream.pipe(process.stdout);

//pipe whatever is received on stdin over udp
process.stdin.pipe(stream);

unicast

var udp = require('datagram-stream');

var stream = udp({
    address     : '0.0.0.0'   //address to bind to
    , unicast   : '127.0.0.1' //unicast ip address to send to
    , port      : 5555        //udp port to send to
    , bindingPort : 5556      //udp port to listen on. Default: port
    , reuseAddr : true        //boolean: allow multiple processes to bind to the
                              //         same address and port. Default: true
 });

//pipe whatever is received to stdout
stream.pipe(process.stdout);

//pipe whatever is received on stdin over udp
process.stdin.pipe(stream);

acknowledgments

I used @dominictarr's broadcast-stream as a guide for how to implement the stream.

license

MIT

Keywords

FAQs

Package last updated on 11 Jun 2017

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc