Skip to content

Instantly share code, notes, and snippets.

@tcr
Last active December 22, 2015 07:48
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 tcr/6439988 to your computer and use it in GitHub Desktop.
Save tcr/6439988 to your computer and use it in GitHub Desktop.

In your computer / Node.js

var http = require('http');
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain', 'Content-Length': 'Hello World\n'.length});
  res.end('Hello World\n');
}).listen(4444);
console.log('Server running at http://localhost:4444/');

Tessel:

var tessel = require('tessel')
  , net = require('net');

console.log('opening tcp socket');

// IP address of the computer you deployed from (local network)
var ip = process.env.DEPLOY_IP;

console.log('connecting to', ip);
var client = net.connect(4444, ip, function () {
  console.log('writing GET request');
  client.write("GET / HTTP/1.0\r\nAccept: *\/*\r\nHost: m.google.com\r\n\r\n");
});

client.on('data', function (buf) {
  // return data
  console.log(buf);
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment