Skip to main content
1 of 4
nickb
  • 341
  • 1
  • 8

NodeJS, 146 bytes

require('http').createServer(function(q,s){s.end(eval(q.socket.remoteAddress.replace(/^.*:/,'').replace(/\./g,'+'))+'\n')}).listen(process.argv[2])

I finally get to post a NodeJS answer! IPv4 only right now.

Sample execution: node script.js 1024. From another terminal:

$ curl 127.0.0.1:1024
128
nickb
  • 341
  • 1
  • 8