沈斌
2018-05-03 8fbd26ea16e81c29926188ec5a8e149c032d102f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/**
 * Created by bin.shen on 5/30/16.
 */
var net = require('net');
 
var HOST = 'dev1.7drlb.com';
var PORT = 6789;
 
var client = new net.Socket();
 
client.connect(PORT, HOST, function() {
    console.log('Connected');
    //client.write(new Buffer([ 0x5A, 0x00, 0x10, 0x01, 0x00, 0x04, 0xac, 0xcf, 0x23, 0xb8, 0x7f, 0xa2 ]));
    //client.write(new Buffer([ 0x5a, 0x00, 0x10, 0x01, 0x00, 0x07, 0xac, 0xcf, 0x23, 0xb8, 0x7f, 0xa2 ]));
    //client.write(new Buffer([ 0x5A, 0x00, 0x33, 0x01, 0x00, 0x01 ]));
    //client.write(new Buffer([0x5a,0x00,0x10,0x01,0x00,0x01,0xac,0xcf,0x23,0xb8,0x7f,0xbf]));
    //client.write(new Buffer([0x5a,0x00,0x00,0x01,0x00,0x01,0xac, 0xcf, 0x23, 0xb8, 0x7d, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4]));
    
    client.write(new Buffer([0x5a, 0x00, 0x3d, 0x01, 0x00, 0x06, 0xac, 0xcf, 0x23, 0xb8, 0x7f, 0xbf, 0xa6, 0x6a, 0x00, 0x51, 0x01, 0x02, 0x03, 0x04, 0x10, 0x06, 0x01, 0x02, 0x00,
        , 0x03, 0xfa, 0xae, 0x3e, 0x64, 0x5e, 0x9c, 0xb3, 0xcf, 0xbb, 0x91, 0xf9, 0xe4, 0x6e, 0xab, 0xef, 0xea, 0xcf, 0x42, 0x79, 0x9a, 0xf8, 0x22, 0x18, 0xec, 0x88, 0x6c, 0x4b, 0xf0, 0x4f, 0x9f, 0xef, 0x29, 0x00, 0x00]))
});
 
client.on('data', function(data) {
    console.log('Received: ' + data.toString('hex'));
    client.destroy();
});
 
client.on('close', function() {
    console.log('Connection closed');
});