Created
February 20, 2013 02:24
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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...'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Could you tell me how to run this server?