Closed Bigdeeua closed 6 years ago
I use node.js to send a request, but in return this always comes: <Buffer 7b 22 53 54 41 54 55 53 22 3a 5b 7b 22 53 54 41 54 55 53 22 3a 22 53 22 2c 22 57 68 65 6e 22 3a 31 35 31 33 30 39 37 31 36 30 2c 22 43 6f 64 65 22 3a ... >
<Buffer 7b 22 53 54 41 54 55 53 22 3a 5b 7b 22 53 54 41 54 55 53 22 3a 22 53 22 2c 22 57 68 65 6e 22 3a 31 35 31 33 30 39 37 31 36 30 2c 22 43 6f 64 65 22 3a ... >
Whatever I sent, the answer is the same, tell me how to get the correct answer please. Example code:
const net = require('net'); let socket = new net.Socket(); socket.connect({ host: '127.0.0.1', port: 4028 }); socket.on('connect', function () { console.log('connected'); socket.write('summary'); }); socket.on('data', function (chunk) { console.log(chunk); }); socket.on('error', function () { console.log('error'); });
Okay, just need to convert hex to string, like this: chunk.toString()
chunk.toString()
I use node.js to send a request, but in return this always comes:
<Buffer 7b 22 53 54 41 54 55 53 22 3a 5b 7b 22 53 54 41 54 55 53 22 3a 22 53 22 2c 22 57 68 65 6e 22 3a 31 35 31 33 30 39 37 31 36 30 2c 22 43 6f 64 65 22 3a ... >
Whatever I sent, the answer is the same, tell me how to get the correct answer please. Example code: