Skip to content

Instantly share code, notes, and snippets.

@aikar
Created November 17, 2010 05:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aikar/703015 to your computer and use it in GitHub Desktop.
Save aikar/703015 to your computer and use it in GitHub Desktop.
var
nnpp = require('./dataparser'),
net = require('net'),
stdin = process.openStdin();
net.createServer(function(conn)
{
nnpp(conn, function(line)
{
console.log("Got line: <" + line + ">");
});
}).listen(function(){
var client = net.createConnection(this.address().port)
stdin.on('data', function(data){
console.log(typeof data);
data = data.toString();
data = data.substr(0,data.length-1);
var msg = data.length + "," + data;
client.write(msg);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment