From 95ba4ff42aa6e13ebb039545ee3714d96f6b1131 Mon Sep 17 00:00:00 2001 From: 沈斌 <bluelazysb@hotmail.com> Date: Sun, 18 Dec 2016 09:48:21 +0800 Subject: [PATCH] 代码优化,删除没用的文件 --- /dev/null | 65 -------------------------------- 1 files changed, 0 insertions(+), 65 deletions(-) diff --git a/config2.js b/config2.js deleted file mode 100644 index de8ea64..0000000 --- a/config2.js +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Created by bin.shen on 6/16/16. - */ - -var config = { - - HOST: "121.40.92.176", - PORT: 5678, - URL: "mongodb://moral_industry_user:m2o0r1a6l_passw0rd_Q1W2E3@127.0.0.1:27017/moral_industry_db", - COLLECTION: "documents", - - OUTPUT_2: [ - 0x6A, 0x00, 0x51, 0x01, 0x00, 0x02, //������(0-5) - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //Mac(6-11) - 0xA2, 0x2A, //������H/L(12-13) - 0x00, 0x00, 0x00, 0x01, //MD1-4(14-17) - 0x00, 0x01, //������H/L(18-19) - 0x00, 0x00, //������������H/L(20-21) - 0x02, 0x00, 0x04, 0x07, 0x10, 0x03, 0x17, 0x10, 0x10, 0x00, //������1-10(22-31) - 0x01, //������(32) - 0x01, //������(33) - 0x1A, 0x85, //������H/L(34-35) - 0x79, 0x28, 0x5C, 0xB0, //IP(36-39) - 0x00, 0x05, //������H/L(40-41) - 0x01, //���(42) - 0x01, //������(43) - 0x01, //������(44) - 0x01, //���(45) - 0x01, //���(46) - 0x06, //������(47) - 0x10, //���(48) - 0x00, 0x00, //������H/L(49-50) - 0x0A, //���������������������(51) - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //(52-78) - 0xF3, //���������(79) - 0x6B //������(80) - ], - - OUTPUT_6: [ - 0x6A, 0x00, 0x0A, 0x01, 0x00, 0x0C, 0xF2, 0x2F, 0x38, 0x6B - ] -}; - -module.exports = config; \ No newline at end of file diff --git a/server2.js b/server2.js deleted file mode 100644 index c719d73..0000000 --- a/server2.js +++ /dev/null @@ -1,65 +0,0 @@ -/** - * Created by bin.shen on 6/16/16. - */ - -var net = require('net'); -var moment = require('moment'); -var mongoClient = require('mongodb').MongoClient; -var config = require('./config2'); -var method = require('./method'); - -mongoClient.connect(config.URL, function(err, db) { - if (err) return; - console.log('Connecting to Mongo DB at ' + config.URL); - - net.createServer(function(socket) { - console.log('CONNECTED: ' + socket.remoteAddress +':'+ socket.remotePort); - - socket.on('data', function(data) { - if(data == null) { - console.log("Error - invalid data - null or undefined"); - return; - } - - var value = data.toString('hex').toLowerCase(); - if(value.length < 12) { - console.log("Error - invalid data - less than 12 character long"); - return; - } - - console.log(moment().format('YYYY-MM-DD HH:mm:ss') + " => " + value); - - /* - //3.��������������������� - if(value.startsWith('5a0034010003')) { - method.insertDocument2(db, value, function(data) {}); - return; - } - - //2.���������������WIFI������ - if(value.startsWith('5a0033010002')) { - method.insertDocument(db, value, function(data) {}); - socket.write(new Buffer(config.OUTPUT_2)); - return; - } - - //6.������������ - if(value.startsWith('5a0033010006')) { - socket.write(new Buffer(config.OUTPUT_6)); - return; - } - - //12.������������ - if(value.startsWith('5a000a01000c')) { - socket.write(new Buffer(config.OUTPUT_6)); - return; - } - */ - }); - socket.on('close', function(data) { - console.log('Closed socket: ' + socket.remoteAddress +' '+ socket.remotePort); - }); - }).listen(config.PORT, config.HOST); - - console.log('TCP Server listening on ' + config.HOST +':'+ config.PORT); -}); \ No newline at end of file -- Gitblit v1.8.0