-
-
Save ChazAttack73/0c5de42374b12b946b77 to your computer and use it in GitHub Desktop.
Process & Net client starter pack
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
const Net = require('net'); | |
// Server is actually this client | |
const Server = Net.connect({host: 'localhost', port: 6969}, function() { | |
process.stdin.setEncoding('utf8'); | |
Server.setEncoding('utf8'); | |
process.stdout.write('SGNL: '); | |
process.stdin.on('data', function(data) { | |
Server.write(data); | |
}); | |
Server.on('data', function(data) { | |
process.stdout.write('\r' + data + '\nSGNL: '); | |
}); | |
}); |
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
const Net = require('net'); | |
const Server = Net.createServer(function(client) { | |
client.write('WELCOME!!!!'); | |
}); | |
Server.listen(6969, function() { | |
console.log('SERVER IS UP'); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment