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