title: Data not sending data over socket in loop
body: <p>I'm trying to send sensor information from instance of NodeJs to another(eventually on another server).  When the while loop in the client code below is enable no connection or data is sent to the server. However when the while loop is commented out I get a connection and data. It's only a single object of data but that's expected when not pulling the sensor data in a loop. </p>
  
  <p>Server Code:</p>
  
  <pre><code>'use strict';
  const net = require('net');
  const PORT = 5000;
  const ADDRESS = '127.0.0.1';
  
  let server = net.createServer(onClientConnected);
  server.listen(PORT, ADDRESS);
  
  function onClientConnected(socket) {
      console.log(`New client: ${socket.remoteAddress}:${socket.remotePort}`);
      socket.destroy();
  }
  
  console.log(`Server started at: ${ADDRESS}:${PORT}`);
  
  function onClientConnected(socket) {
      let clientName = `${socket.remoteAddress}:${socket.remotePort}`;
      console.log(`${clientName} connected.`);
      socket.on('data', (data) =&gt; {
      let m = data.toString().replace(/[\n\r]*$/, '');
      var d = {msg:{info:m}};
      console.log(`${clientName} said: ${data.toString()}`);
      socket.write(`We got your message (${m}). Thanks!\n`);
  });
  
  socket.on('end', () =&gt; {
      console.log(`${clientName} disconnected.`);
  });
  </code></pre>
  
  <p>Client Code:</p>
  
  <pre><code>var n = require('net');
  var s = n.Socket();
  s.connect(5000, 'localhost');
  var i2c = require('i2c-bus');
  var MPU6050 = require('i2c-mpu6050');
  
  var address = 0x68;
  var i2cl = i2c.openSync(1);
  var sensor = new MPU6050(i2cl, address);
  
  //while (true) {
      var data = sensor.readSync();
      console.log(data);
      s.write(data.toString());
  //}
  </code></pre>