Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js nodejs如何将变量发送到tcpsocket_Node.js - Fatal编程技术网

Node.js nodejs如何将变量发送到tcpsocket

Node.js nodejs如何将变量发送到tcpsocket,node.js,Node.js,我想向client.write()发送变量comm; 谢谢 client.write(comm“\n”、“binary”);没关系,哈哈 var comm = process.argv[2]; var client = new net.Socket(); client.connect(PORT, HOST,function() { console.log('CONNECTED TO: ' + HOST + ':' + PORT); client.write('global.com

我想向client.write()发送变量comm; 谢谢

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

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");
});