index.js
function lookupEndPoint (local) {
  // No interfaces bound by the desired port. Note that this would also work for
  // zero, which indicates an ephemeral binding, but we check for that case
  // explicitly before calling this function.
  if (!endPoints[local.port]) return null;

  // Read datagram socket from cache.
  var endPoint = endPoints[local.port][local.address];

  // If no datagram exists, ensure that we'll be able to create one. This only
  // inspects ports that have been bound by UDT, not by other protocols, so
  // there is still an opportunity for error when the UDP bind is invoked.
  if (!endPoint) {
    if (endPoints[local.port][0]) {
      throw new Error('Already bound to all interfaces.');
    }
    if (local.address == 0) {
      throw new Error('Cannot bind to all interfaces because some interfaces are already bound.');
    }
  }

  // Return cached datagram socket or nothing.
  return endPoint;
}
function lookupEndPoint (local) {
  // No interfaces bound by the desired port. Note that this would also work for
  // zero, which indicates an ephemeral binding, but we check for that case
  // explicitly before calling this function.
  if (!endPoints[local.port]) return null;

  // Read datagram socket from cache.
  var endPoint = endPoints[local.port][local.address];

  // If no datagram exists, ensure that we'll be able to create one. This only
  // inspects ports that have been bound by UDT, not by other protocols, so
  // there is still an opportunity for error when the UDP bind is invoked.
  if (!endPoint) {
    if (endPoints[local.port][0]) {
      throw new Error('Already bound to all interfaces.');
    }
    if (local.address == 0) {
      throw new Error('Cannot bind to all interfaces because some interfaces are already bound.');
    }
  }

  // Return cached datagram socket or nothing.
  return endPoint;
}
function lookupEndPoint ( local ) { // No interfaces bound by the desired port. Note that this would also work for // zero, which indicates an ephemeral binding, but we check for that case // explicitly before calling this function. if ( ! endPoints [ local . port ] ) return null ; // Read datagram socket from cache. var endPoint = endPoints [ local . port ] [ local . address ] ; // If no datagram exists, ensure that we'll be able to create one. This only // inspects ports that have been bound by UDT, not by other protocols, so // there is still an opportunity for error when the UDP bind is invoked. if ( ! endPoint ) { if ( endPoints [ local . port ] [ 0 ] ) { throw new Error ( 'Already bound to all interfaces.' ) ; } if ( local . address == 0 ) { throw new Error ( 'Cannot bind to all interfaces because some interfaces are already bound.' ) ; } } // Return cached datagram socket or nothing. return endPoint ; }
Look up an UDP datagram socket in the cache of bound UDP datagram sockets by the user specified port and address.
Look up an UDP datagram socket in the cache of bound UDP datagram sockets by the user specified port and address .