Skip to content

Instantly share code, notes, and snippets.

@ry
Created November 18, 2010 05:45
Show Gist options
  • Star 13 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save ry/704668 to your computer and use it in GitHub Desktop.
Save ry/704668 to your computer and use it in GitHub Desktop.
#!/usr/bin/env node
// requires node v0.3
// telnet.js 80 google.com
net = require('net');
a = process.argv.slice(2);
if (!a.length) {
console.error("telnet.js port [ host=localhost ]");
process.exit(1);
}
s = require('net').Stream();
s.connect.apply(s, a);
s.pipe(process.stdout);
process.openStdin().pipe(s);
@ThisIsMissEm
Copy link

That is kinda too awesome. Only what about \commands? :P

@rsdoiel
Copy link

rsdoiel commented Nov 18, 2010

I second that. I really like how streams have evolved with pipe(). Very cool.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment