2015-11-23 91 views
-2
var comm = process.argv[2]; 
var client = new net.Socket(); 
client.connect(PORT, HOST,function() { 
    console.log('CONNECTED TO: ' + HOST + ':' + PORT); 
    client.write('global.comm \n',"binary"); 
}); 

我想發送變量comm到client.write(); 謝謝!nodejs如何發送變量到tcpsocket

回答

0

client.write(comm「\ n」,「binary」);這就好,哈哈!