代码拉取完成,页面将自动刷新
var net = require('net');
// 指定连接的tcp server ip,端口
var options = {
host : '127.0.0.1',
port : 5678
}
var tcp_client = net.Socket();
// 连接 tcp server
tcp_client.connect(options,function(){
console.log('connected to Server');
var buf = Buffer.from('01050002FF002DFA','hex')
tcp_client.write(buf);
})
var count = 0
// 接收数据
tcp_client.on('data',function(data){
//tcp_client.write(count.toString())
//count++
console.log('received data: %s from server', data.toString());
})
tcp_client.on('end',function(){
console.log('data end!');
})
tcp_client.on('error', function () {
console.log('tcp_client error!');
})
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。