Skip to content

Instantly share code, notes, and snippets.

@tjfontaine
Created January 8, 2014 00:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tjfontaine/8309764 to your computer and use it in GitHub Desktop.
Save tjfontaine/8309764 to your computer and use it in GitHub Desktop.
var net = require('net');
var server = net.createServer(function(conn) {
console.log('client connection');
conn.destroy();
}).listen(function() {
console.log('server listening', server.address());
net.connect(server.address());
});
var tracing = require('tracing');
tracing.on('net', 'server-connection', function() {
console.log('tracing', arguments);
server.close();
});
@tjfontaine
Copy link
Author

server listening { address: '0.0.0.0', family: 'IPv4', port: 54116 }
tracing { '0': 13, '1': '127.0.0.1', '2': 54117, '3': 0 }
client connection

@groundwater
Copy link

I tried this, and yes got what I expected

var tracing = require('tracing');

tracing.on('http', 'server-request', function () {
  console.log('----> (trace) New Requst');
});

var http = require('http');

var serv = http.createServer(function (req, res) {
  res.write('HIII');
  res.end();
})

serv.listen(8080);

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