Skip to content

Instantly share code, notes, and snippets.

@w7089
Created January 9, 2019 16:25
Show Gist options
  • Save w7089/4e0cea63727c16ac6f8c41b7fd621279 to your computer and use it in GitHub Desktop.
Save w7089/4e0cea63727c16ac6f8c41b7fd621279 to your computer and use it in GitHub Desktop.
server.js
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