Skip to content

Instantly share code, notes, and snippets.

@korayal
korayal / nodejs-udpclient.js
Created December 7, 2012 12:34
Node.js: UDP client (that should wait for a response before closing)
var dgram = require('dgram');
sendUDPMessage("10.1.2.3", 1234, Buffer("Release The Kraken!"));
function sendUDPMessage(targetIP, targetPORT, message){
var client = dgram.createSocket("udp4");
client.on('error', function(e) {
throw e;