nodejs如何将变量发送到tcpsocket

时间:2015-11-23 01:41:52

标签: node.js

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(); 谢谢!

1 个答案:

答案 0 :(得分:0)

client.write(comm“\ n”,“binary”);那没关系,哈哈!