Skip to content

Instantly share code, notes, and snippets.

@watson
Created August 27, 2018 12:49
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save watson/16938f3b36e2ce1190f9d7e4e100b1c2 to your computer and use it in GitHub Desktop.
HTTP server that half-closes the socket when an incoming HTTP request is received
'use strict'
const http = require('http')
const server = http.createServer(function (req, res) {
console.log(req.method, req.url)
res.socket.end() // Half-close the socket by sending FIN packet
})
server.listen(8200, function () {
console.log('Server running on http://localhost:8200')
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment