2012-10-31 34 views

回答

0

鏈接到他們的實施可在GitHub庫中鏈接視頻 - mirceageorgescu/raspi-tank


node.js完全可以運行程序。草案可能如下所示。

服務器

var exec = require('child_process').exec; 
io.sockets.on('connection', function(socket) { 
    socket.on('exec', function(cmd) { 
    exec(cmd, function(err, stdout, stderr) { 
     // do something with the output or not 
    }); 
    }); 
}); 

客戶

socket.emit('exec', 'cat file.txt'); 

關於如何啓動服務器上的插座或從客戶端連接到它的信息可以從socket.io