Skip to content

Instantly share code, notes, and snippets.

@ChazAttack73
Forked from sgnl/client.js
Created January 9, 2016 21:56
Show Gist options
  • Save ChazAttack73/0c5de42374b12b946b77 to your computer and use it in GitHub Desktop.
Save ChazAttack73/0c5de42374b12b946b77 to your computer and use it in GitHub Desktop.
Process & Net client starter pack
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: ');
});
});
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