Created
August 27, 2018 12:49
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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