From 0a6bf0aecbb2410d3f1e3e90a7e1a0b46f842683 Mon Sep 17 00:00:00 2001 From: mpuebla Date: Fri, 12 Apr 2019 15:09:58 -0300 Subject: [PATCH] cambios jose --- index.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 7a9f140..30a792c 100644 --- a/index.js +++ b/index.js @@ -3,7 +3,7 @@ const Net = require('net'); const converter = require('hex2dec'); // The port number and hostname of the server. const port = 10001; -const host = '190.15.193.76'; +const host = 'fipdebo.ddns.net'; var respuesta = ''; // Create a new TCP client. @@ -15,19 +15,20 @@ client.connect({ port: port, host: host }, function() { console.log('TCP connection established with the server.'); var code = String.fromCharCode(01); // The client can now send data to the server by writing to its socket. - console.info(client.write(code + 'i201TT')); + console.info(client.write(code + 'i20100')); }); // The client can also receive data from the server by reading from its socket. client.on('data', function(chunk) { var data = chunk.toString('utf8'); + console.log('response', data); if (respuesta) { respuesta += data; } else { var respuesta = data; } - if (data[data.length - 1].charCodeAt(0) == 3 && respuesta.slice(1,5) == 'i201') { + if (data[data.length - 1].charCodeAt(0) == 3) { var indice = 0; var fecha = new Date(); var respuesta = respuesta.slice(17, respuesta.length); -- 1.9.1