lib/udplistener.js
/**
 * Handle events from the UDP server.
 * @param {UdpListener} instance The UdpListener instance.
 */
Handle events from the UDP server.
Handle events from the UDP server .
function handleServerEvents(instance) {
  instance.server.on('listening', function() {
    let address = instance.server.address();
    console.log('barnowl-huawei: UDP listening on ' + address.address + ':' +
                address.port);
  });
  instance.server.on('message', function(data, remote) {
    let origin = remote.address + ':' + remote.port;
    let time = new Date().getTime();
    instance.decoder.handleData(data, origin, time, instance.decodingOptions);
  });
  instance.server.on('error', function(err) {
    instance.server.close();
    console.log('barnowl-huawei: UDP error', err);
  });
}
function handleServerEvents ( instance ) { instance . server . on ( 'listening' , function ( ) { let address = instance . server . address ( ) ; console . log ( 'barnowl-huawei: UDP listening on ' + address . address + ':' + address . port ) ; } ) ; instance . server . on ( 'message' , function ( data , remote ) { let origin = remote . address + ':' + remote . port ; let time = new Date ( ) . getTime ( ) ; instance . decoder . handleData ( data , origin , time , instance . decodingOptions ) ; } ) ; instance . server . on ( 'error' , function ( err ) { instance . server . close ( ) ; console . log ( 'barnowl-huawei: UDP error' , err ) ; } ) ; }
Handle events from the UDP server.
Handle events from the UDP server .