datagram-stream
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'
, multicast : '239.5.5.5'
, port : 5555
, bindingPort : 5556
, reuseAddr : true
, loopback : true
});
stream.pipe(process.stdout);
process.stdin.pipe(stream);
broadcast
var udp = require('datagram-stream');
var stream = udp({
address : '0.0.0.0'
, broadcast : '255.255.255.255'
, port : 5555
, bindingPort : 5556
, reuseAddr : true
});
stream.pipe(process.stdout);
process.stdin.pipe(stream);
unicast
var udp = require('datagram-stream');
var stream = udp({
address : '0.0.0.0'
, unicast : '127.0.0.1'
, port : 5555
, bindingPort : 5556
, reuseAddr : true
});
stream.pipe(process.stdout);
process.stdin.pipe(stream);
acknowledgments
I used @dominictarr's broadcast-stream as a
guide for how to implement the stream.
license
MIT