Created
February 19, 2018 13:51
-
-
Save kasvith/d49e851ec3a301d365cca228c8b5e0e0 to your computer and use it in GitHub Desktop.
NodeJS TCP server
This file contains 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 net = require('net') | |
net.createServer((socket) => { | |
socket.on('data', (payload) => { | |
socket.write('Echo server\r\n') | |
console.info(`Client: ${socket.remoteAddress} Data: %s`, payload) | |
}) | |
}).listen(5000) | |
console.log('Server is up on port 5000') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment