Skip to content

Instantly share code, notes, and snippets.

@w7089
Created Jan 9, 2019
Embed
What would you like to do?
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