From b5d6c7a27b0ec906f8d1af1cb8e25b0045e333bd Mon Sep 17 00:00:00 2001 From: 沈斌 <bluelazysb@hotmail.com> Date: Thu, 15 Dec 2016 13:26:44 +0800 Subject: [PATCH] 调整传感器数据结构 --- server.js | 11 +++++------ 1 files changed, 5 insertions(+), 6 deletions(-) diff --git a/server.js b/server.js index 6c2a25d..8154945 100644 --- a/server.js +++ b/server.js @@ -38,7 +38,7 @@ if(value.startsWith('5a0000010003')) { var output = [ 0x6A, 0x00, 0x00, 0x01, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6B ]; method.insertData(db, value, function(data, rank) { - method.insertDocument2(db, value, rank, function(data) {}); + //method.insertDocument2(db, value, rank, function(data) {}); var fields = method.padLeft(rank.toString(16), 8).match(/.{2}/g); output[6] = method.toDec(fields[0]); output[7] = method.toDec(fields[1]); @@ -112,7 +112,10 @@ } mongoClient.connect(config.URL, function(err, db) { - if (err) return; + if (err) { + console.log(err.message); + return; + } console.log('Connecting to Mongo DB at ' + config.URL); net.createServer().on('connection', function(socket){ @@ -150,10 +153,6 @@ socket.on('close', function(data) { console.log('Closed socket: ' + socket.remoteAddress +' '+ socket.remotePort); - }); - - socket.on('close', function(data) { - console.log('Closed socket: ' + socket.remoteAddress + ' ' + socket.remotePort); }); }).listen(config.PORT, config.HOST); -- Gitblit v1.8.0