Skip to content

Instantly share code, notes, and snippets.

@sivy
Created February 24, 2011 17:17
Show Gist options
  • Select an option

  • Save sivy/842482 to your computer and use it in GitHub Desktop.

Select an option

Save sivy/842482 to your computer and use it in GitHub Desktop.
(wr)tt:[~]> ./test.js
test
/Users/steve/test.js:12
throw err;
^
TypeError: Bad file descriptor argument
at Socket.sendto (dgram.js:259:25)
at dgram.js:246:14
at dgram.js:40:5
at dns.js:159:33
at IOWatcher.callback (dns.js:53:15)
(wr)tt:[~]>
#!/usr/local/bin/node
console.log ("test\n");
var dgram = require('dgram');
var message = new Buffer('node_test.stat|c');
var client = dgram.createSocket('udp4');
client.send(message, 0, message.length, 8125, 'rayners.org',
function (err, bytes) {
if (err) {
throw err;
}
console.log("Wrote " + bytes + " bytes to socket.");
});
client.close();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment