wake_on_lan
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -1,27 +0,30 @@ | ||
{ "name" : "wake_on_lan" | ||
, "version" : "0.0.4" | ||
, "description" : "generate and send Wake-on-LAN magic packets" | ||
, "main": "./wake_on_lan.js" | ||
, "licenses": [ | ||
{ "type": "MIT" | ||
, "url": "http://github.com/agnat/node_wake_on_lan/raw/master/LICENSE" | ||
{ | ||
"name": "wake_on_lan", | ||
"version": "0.0.5", | ||
"description": "generate and send Wake-on-LAN magic packets", | ||
"main": "./wake_on_lan.js", | ||
"licenses": [ | ||
{ | ||
"type": "MIT", | ||
"url": "http://github.com/agnat/node_wake_on_lan/raw/master/LICENSE" | ||
} | ||
] | ||
, "bugs": { "url": "http://github.com/agnat/node_wake_on_lan/issues" } | ||
, "repository": | ||
{ "type": "git" | ||
, "url": "git://github.com/agnat/node_wake_on_lan.git" | ||
} | ||
, "author": { | ||
"name": "David Siegel" | ||
, "email": "david@artcom.de" | ||
, "github": "agnat" | ||
} | ||
, "contributors": [ | ||
{ "name": "Jann Horn" | ||
, "github": "thejh" | ||
], | ||
"bugs": { | ||
"url": "http://github.com/agnat/node_wake_on_lan/issues" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/agnat/node_wake_on_lan.git" | ||
}, | ||
"author": { | ||
"name": "David Siegel", | ||
"email": "david@artcom.de", | ||
"github": "agnat" | ||
}, | ||
"contributors": [ | ||
{ | ||
"name": "Jann Horn", | ||
"github": "thejh" | ||
} | ||
] | ||
} | ||
@@ -6,6 +6,10 @@ var dgram = require('dgram') | ||
var allocBuffer = Buffer.alloc ? | ||
function allocBuffer(s) { return Buffer.alloc(s) } : | ||
function allocBuffer(s) { return new Buffer(s) } | ||
var mac_bytes = 6; | ||
exports.createMagicPacket = function(mac) { | ||
var mac_buffer = new Buffer(mac_bytes) | ||
var mac_buffer = allocBuffer(mac_bytes) | ||
, i | ||
@@ -25,3 +29,3 @@ ; | ||
var num_macs = 16 | ||
, buffer = new Buffer((1 + num_macs) * mac_bytes); | ||
, buffer = allocBuffer((1 + num_macs) * mac_bytes); | ||
for (i = 0; i < mac_bytes; ++i) { | ||
@@ -28,0 +32,0 @@ buffer[i] = 0xff; |
6712
76
76