Skip to content

Instantly share code, notes, and snippets.

@hyounggyu
Last active December 15, 2015 15:19
Show Gist options
  • Select an option

  • Save hyounggyu/5281443 to your computer and use it in GitHub Desktop.

Select an option

Save hyounggyu/5281443 to your computer and use it in GitHub Desktop.
var net = require('net');
var fs = require('fs');
var tmp;
fs.readdir('/', function (err, files) {
//files.forEach(function (file) {
//});
tmp = JSON.stringify(files);
});
var client = new net.Socket();
client.connect(3303,'127.0.0.1', function () {
client.write('{ "command": "hello", "data": '+tmp+'}');
client.destroy();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment