Closed rollercontainer closed 6 years ago
Hi ! sorry for the long delay on replying, have been very busy nowadays. I tried the example in my local machine and other machines without a problem. I'm thinking you might have an outdate Node.js version? I'm using 5.12.0 here and is ok. Please check that and let me know!
Hi, I tried your example to create a packet and received an error of dgram:
root@smarthome:~# node e131test.js dgram.js:300 throw new RangeError('Offset + length beyond buffer length'); ^
RangeError: Offset + length beyond buffer length at Socket.send (dgram.js:300:11) at Client.send (/root/node_modules/e131/lib/client.js:49:16) at cycleColor (/root/e131test.js:16:10) at Object. (/root/e131test.js:20:1)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Function.Module.runMain (module.js:441:10)
at startup (node.js:139:18)
e131test.js:
var e131 = require('e131'); var client = new e131.Client('192.168.178.135'); var packet = client.createPacket(3); var slotsData = packet.getSlotsData();
packet.setSourceName('test E1.31 client'); packet.setUniverse(0x01); packet.setOption(packet.Options.PREVIEW, false); packet.setPriority(packet.DEFAULT_PRIORITY);
var color = 0; function cycleColor() { for (var idx=0; idx<slotsData.length; idx++) { slotsData[idx] = color % 0xff; color = color + 90; } client.send(packet, function () { setTimeout(cycleColor, 125); }); } cycleColor();