Skip to main content
edited body
Source Link
nickb
  • 341
  • 1
  • 8

NodeJS, 146 134 126127 bytes

require('http').createServer((q,s)=>s.end(eval(0+q.socket.remoteAddress.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

NodeJS, 146 134 126 bytes

require('http').createServer((q,s)=>s.end(eval(0+q.socket.remoteAddress.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

NodeJS, 146 134 127 bytes

require('http').createServer((q,s)=>s.end(eval(0+q.socket.remoteAddress.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
added 3 characters in body
Source Link
nickb
  • 341
  • 1
  • 8

NodeJS, 146 134134 126 bytes

require('http').createServer(function(q,s){s=>s.end(eval(0+q.socket.remoteAddress.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

NodeJS, 146 134 bytes

require('http').createServer(function(q,s){s.end(eval(0+q.socket.remoteAddress.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

NodeJS, 146 134 126 bytes

require('http').createServer((q,s)=>s.end(eval(0+q.socket.remoteAddress.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
deleted 1 character in body
Source Link
nickb
  • 341
  • 1
  • 8

NodeJS, 146146 134 bytes

require('http').createServer(function(q,s){s.end(eval(q0+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

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

NodeJS, 146 134 bytes

require('http').createServer(function(q,s){s.end(eval(0+q.socket.remoteAddress.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
Source Link
nickb
  • 341
  • 1
  • 8
Loading