Skip to content

Instantly share code, notes, and snippets.

@mrwillihog
Created June 18, 2013 12:07
Show Gist options
  • Save mrwillihog/5804815 to your computer and use it in GitHub Desktop.
Save mrwillihog/5804815 to your computer and use it in GitHub Desktop.
var PORT = 8181,
STATSD_HOST = "0.0.0.0",
STATSD_PORT = 8125;
var express = require('express'),
dgram = require('dgram'),
socket = dgram.createSocket('udp4'),
app = express(),
msg;
app.get('/', function (request, response) {
request.query.stat.forEach(function (item) {
msg = new Buffer(item);
socket.send(msg, 0, msg.length, STATSD_PORT, STATSD_HOST);
});
response.end();
});
app.listen(PORT);
console.log("Listening on port " + PORT);
@johnsoncheng
Copy link

what's the difference between 0.0.0.0 and localhost

@johnsoncheng
Copy link

so is the url ?stat=____ then

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment