Created
January 9, 2019 16:25
-
-
Save w7089/4e0cea63727c16ac6f8c41b7fd621279 to your computer and use it in GitHub Desktop.
server.js
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
const server = require('net').createServer() | |
server.on('connection', socket => { | |
console.log('client connected') | |
socket.write('welcom client\n') | |
socket.on('data', data => { | |
console.log('data is:', data) | |
socket.write('data is: ') | |
socket.write(data) | |
socket.on('end', () => { | |
console.log('client disconnected') | |
}) | |
}) | |
}) | |
server.listen(8000, ()=> console.log('server bound')) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment