/* getRemainingIpnFields()
Gets the remaining fields of the IPN to be later appended to the return message
553187
private function getRemainingIpnFields()
    {
        $ipnMessage = $this->returnMessage();

        $remainingFields = array(
                            'NotificationReferenceId' =>$ipnMessage['NotificationReferenceId'],
                            'NotificationType' =>$ipnMessage['NotificationType'],
                            'SellerId' =>$ipnMessage['SellerId'],
                            'ReleaseEnvironment' =>$ipnMessage['ReleaseEnvironment'] );

        return $remainingFields;
    }
639085
private static InetAddress[] getAllLocalInetAddresses(final Log log) 
    throws SocketException {

        final List addresses = new ArrayList();
        
        // get the network adapters
        final Enumeration netInterfaces = NetworkInterface.getNetworkInterfaces();
        while (netInterfaces.hasMoreElements()) {
            final NetworkInterface ni = (NetworkInterface)netInterfaces.nextElement();
            if (log != null) {
                log.debug("Found interface: " + ni.getName());
            }
            
            // get the IPs for this network interface
            final Enumeration ips = ni.getInetAddresses();
            while (ips.hasMoreElements()) {
                final InetAddress ip = (InetAddress)ips.nextElement();
                if (log != null) {
                    log.debug("Found ip: " + ip.getHostName() + "/" 
                        + ip.getHostAddress() + " on interface: " + ni.getName());
                }

                // ignore the local loopback address: 127.0.0.1
                if (!ip.isLoopbackAddress()) {
                    if (log != null) {
                        log.debug("Let's add this IP: " + ip.getCanonicalHostName());
                    }
                    addresses.add(ip);
                }
            }
        }
        
        return (InetAddress[])addresses.toArray(new InetAddress[addresses.size()]);
    }
1191484
function getFqdnForIpAddress(ipAddress, cb) {
  dns.reverse(ipAddress, function(err, fqdns) {
    if (err) {
      cb(err, fqdns);
    } else if (fqdns[0].toLowerCase() === localhostIdentifier) {
      getFqdn(localhostIdentifier, cb);
    } else {
      cb(err, fqdns[0]);
    }
  });
}
501902
private long getRemainingBytes() {
        if (in != null) {
            if (!useLoadBuf) {
                return in.remaining();
            }
            try {
                if (channel.isOpen()) {
                    return channelSize - channel.position() + in.remaining();
                } else {
                    return in.remaining();
                }
            } catch (Exception e) {
                log.error("Error getRemainingBytes", e);
            }
        }
        return 0;
    }
455475
private String[] probeIps() {
        Set<String> ips = new TreeSet<String>();
        for (int i = 0; i < 32; ++i) {
            InetSocketAddress sa = new InetSocketAddress(_server, _port);
            ips.add(sa.getAddress().getHostAddress());
        }

        if (LOG.isDebugEnabled()) {
            StringBuffer sb = new StringBuffer();
            for (String ip : ips) {
                sb.append(ip);
                sb.append(" ");
            }
            LOG.debug(sb.toString());
        }

        return (String[]) ips.toArray(new String[0]);
    }
585918
private List<InetAddress> findAddresses() throws HarvestException {
		// Stores found addresses
		List<InetAddress> found = new ArrayList<InetAddress>(3);

		// Retrieve list of available network interfaces
		Enumeration<NetworkInterface> interfaces = getNetworkInterfaces();
		while (interfaces.hasMoreElements()) {
			NetworkInterface iface = interfaces.nextElement();

			// Evaluate network interface
			if (!useNetworkInterface(iface)) {
				continue;
			}

			// Retrieve list of available addresses from the network interface
			Enumeration<InetAddress> addresses = iface.getInetAddresses();

			while (addresses.hasMoreElements()) {
				InetAddress address = addresses.nextElement();

				// loopback addresses are discarded
				if (address.isLoopbackAddress()) {
					continue;
				}

				// Ignore IPv6 addresses for now
				if (address instanceof Inet4Address) {
					found.add(address);
				}
			}
		}
		return found;
	}
143536
public function getUserIP()
    {
        foreach ($this->ipHeaders as $ipHeader) {
            if ($this->hasHeader($ipHeader)) {
                return trim(explode(',', $this->getHeaderLine($ipHeader))[0]);
            }
        }

        return $this->getRemoteIP();
    }
67105
function IPmyipis () {
  const self = this
  self.getIP = cb => {
    request('http://myip.is', (err, _, body) => {
      if (err) return cb(err)
      const m = body.match(/title="copy ip address">(\d+\.\d+\.\d+\.\d+)<\/a>/)
      if (!m) return cb(new Error('Invalid response'))
      return cb(null, m[1])
    })
  }
}
1148132
@Override
	public String retrievePublicIpAddress( TargetHandlerParameters parameters, String machineId )
	throws TargetException {

		ComputeService computeService = jcloudContext( parameters.getTargetProperties());
		NodeMetadata metadata = computeService.getNodeMetadata( machineId );

		String result = null;
		if( metadata != null
				&& metadata.getPublicAddresses() != null
				&& ! metadata.getPublicAddresses().isEmpty())
			result = metadata.getPublicAddresses().iterator().next();

		return result;
	}
275170
def getRemainingCredits(self):
        

        if 'status' in self._response.keys():
            if (self._response['status'] is not None) and ('remaining_credits' in self._response['status'].keys()):
                if self._response['status']['remaining_credits'] is not None:
                    return self._response['status']['remaining_credits']
                else:
                    return ''
            else:
                print("Not remaining credits field\n")
        else:
            return None
624784
public function next() {
        if (!isset($this->current)) {
            throw new BadMethodCallException('You need to call method "load()" first.');
        }

        for ($ipLong = $this->current; $ipLong <= $this->last; $ipLong++) {
            $this->current = $ipLong;

            if ($this->isUsed($ipLong) === false) {
                return long2ip($ipLong);
            }
        }

        throw new RuntimeException('No free IP addresses left');
    }
321225
public static List<InetAddress> getMulticastAddresses() throws SocketException {
        Enumeration<NetworkInterface> nifs = NetworkInterface.getNetworkInterfaces();
        List<InetAddress> ret = new ArrayList<InetAddress>();
        while (nifs.hasMoreElements()) {
            NetworkInterface nif = nifs.nextElement();
            if (checkMethod(nif, supportsMulticast) && checkMethod(nif, isUp)) {
                Enumeration<InetAddress> addresses = nif.getInetAddresses();
                while (addresses.hasMoreElements()) {
                    InetAddress addr = addresses.nextElement();
                    // TODO: IpV6 support
                    if (!(addr instanceof Inet6Address)) {
                        ret.add(addr);
                    }
                }
            }
        }
        return ret;
    }
1112427
function ourAddresses (peerInfo) {
  const ourPeerId = peerInfo.id.toB58String()
  return peerInfo.multiaddrs.toArray()
    .reduce((ourAddrs, addr) => {
      const peerId = addr.getPeerId()
      addr = addr.toString()
      const otherAddr = peerId
        ? addr.slice(0, addr.lastIndexOf(`/ipfs/${peerId}`))
        : `${addr}/ipfs/${ourPeerId}`
      return ourAddrs.concat([addr, otherAddr])
    }, [])
    .filter(a => Boolean(a))
    .concat(`/ipfs/${ourPeerId}`)
}
1166434
private IPPacket handleFragmentation(final IPPacket ipPacket) {
        if (this.fragmentListener == null) {
            return null;
        }
        try {
            return this.fragmentListener.handleFragment(ipPacket);
        } catch (final Throwable t) {
            logger.warn("Exception thrown by FragmentListener when processing the IP frame", t);
        }
        return null;
    }
470647
@Nullable
    public static String determineIpAddress() throws SocketException {
        SocketException caughtException = null;
        for (final Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces(); networkInterfaces.hasMoreElements();) {
            try {
                final NetworkInterface nextInterface = networkInterfaces.nextElement();
                if (! nextInterface.isLoopback() && ! nextInterface.isVirtual() && ! nextInterface.isPointToPoint()) {
                    for (final Enumeration<InetAddress> addresses = nextInterface.getInetAddresses(); addresses.hasMoreElements(); ) {
                        final InetAddress inetAddress = addresses.nextElement();
                        final byte[] address = inetAddress.getAddress();
                        if ((address.length == 4) //  we don't need no steenking IPv6
                                && ((address[0] != 127) || (address[1] != 0))) {    //  don't want localhost IP
                            return inetAddress.getHostAddress();
                        }
                    }
                }
            } catch (SocketException ex) {
                // We're not going to extract an IP address from this interface, so move on to the next one.
                // If we find a qualifying interface, we won't care that some other interface gave us problems.
                // If we don't find one, this exception might be informative.
                caughtException = ex;
            }
        }

        if (caughtException != null) {
            throw caughtException;
        }
        return null;
    }
1259506
@Override
    public Set<IPortletEntity> getPortletEntities(IPortletDefinitionId portletDefinitionId) {
        final Set<IPortletEntity> portletEntities =
                this.delegatePortletEntityDao.getPortletEntities(portletDefinitionId);
        return this.wrapEntities(portletEntities);
    }
16864
function getSocketAddressFromURLSafeHostname(hostname) {
    return __awaiter(this, void 0, void 0, function* () {
        // IPv4 addresses are fine
        if (net_1.isIPv4(hostname))
            return hostname;
        // IPv6 addresses are wrapped in [], which need to be removed
        if (/^\[.+\]$/.test(hostname)) {
            const potentialIPv6 = hostname.slice(1, -1);
            if (net_1.isIPv6(potentialIPv6))
                return potentialIPv6;
        }
        // This is a hostname, look it up
        try {
            const address = yield lookupAsync(hostname);
            // We found an address
            if (address)
                return address;
        }
        catch (e) {
            // Lookup failed, continue working with the hostname
        }
        return hostname;
    });
}