Skip to content

Instantly share code, notes, and snippets.

@CodeFoodPixels
Created September 1, 2014 22:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CodeFoodPixels/ce1aaf3d0c8290324d00 to your computer and use it in GitHub Desktop.
Save CodeFoodPixels/ce1aaf3d0c8290324d00 to your computer and use it in GitHub Desktop.
Simple UDP listener in node
var dgram = require('dgram');
var server = dgram.createSocket('udp4');
server.bind(9600);
server.on('message', function (message) {
if (message.toString().match('{"source":"kankun-plug"')) {
console.log(message.toString());
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment