Skip to content

Instantly share code, notes, and snippets.

@arvitaly
Last active December 29, 2020 09:39
Show Gist options
  • Save arvitaly/a671451a8ef3587a9f558719ae571193 to your computer and use it in GitHub Desktop.
Save arvitaly/a671451a8ef3587a9f558719ae571193 to your computer and use it in GitHub Desktop.
const net = require("net");
const server = net
.createServer(function(socket) {
socket.on("data", function(data) {
if (data.toString() === "close") {
socket.end();
} else {
socket.write(data.toString());
}
});
});
server.listen(2222, "0.0.0.0");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment