Skip to content

Instantly share code, notes, and snippets.

@janmonschke
Created February 20, 2013 02:24
Show Gist options
  • Star 12 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save janmonschke/4992216 to your computer and use it in GitHub Desktop.
Save janmonschke/4992216 to your computer and use it in GitHub Desktop.
A simple debugging server for the Samsung SmartTV platform. Simply start the server and then connect your machine to the TV and it'll print out (and save) everything the TV sends
var net = require('net');
var fs = require('fs');
// file name for the current log
var fileName = __dirname + '/log_' + new Date().getTime();
// Start a TCP Server
var server = net.createServer(function (socket) {
// Log what the TV sends
socket.on('data', function (data) {
var log = '[TV] ' + data;
fs.appendFileSync(fileName, log);
console.log(log);
});
// TV disconnected
socket.on('end', function () {
console.log('[TV] disconnected')
});
});
// listen to the port which the TV connects to
var port = 45634;
server.listen(port);
console.log('The debugging server is listening to port: ' + port);
console.log('Waiting for TV messages...');
@ehaab
Copy link

ehaab commented Oct 22, 2017

Could you tell me how to run this server?

@ogrodowiczp
Copy link

@ehaab, node smarttv-debugging-server.js

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