# Ketai library, KetaiNet.getIP(); Error

**URL:** <https://discourse.processing.org/t/ketai-library-ketainet-getip-error/11415>\
**Category:** Processing for Android\
**Created:** [May 20, 2019, 11:04am UTC](https://discourse.processing.org/t/ketai-library-ketainet-getip-error/11415 "2019-05-20T11:04:19Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![GWAK](https://avatars.discourse-cdn.com/v4/letter/g/13edae/32.png) [@GWAK](https://discourse.processing.org/u/GWAK)\
**Post date:** [May 23, 2019, 3:29pm UTC](https://discourse.processing.org/t/ketai-library-ketainet-getip-error/11415/11 "2019-05-23T15:29:15Z")

</div>

@akenaton

This is ‘Ketai library source code’.

> static public String getIP() {  
> String thing = “0.0.0.0”;
> 
> ```
> try {
> for (Enumeration<NetworkInterface> en = NetworkInterface
> .getNetworkInterfaces(); en.hasMoreElements();) {
> NetworkInterface intf = en.nextElement();
> for (Enumeration<InetAddress> enumIpAddr = intf
> .getInetAddresses(); enumIpAddr.hasMoreElements();) {
> InetAddress inetAddress = enumIpAddr.nextElement();
> if (!inetAddress.isLoopbackAddress()
> && thing == "0.0.0.0"
> && inetAddress.getHostAddress().matches(
> "\\b(?:\\d{1,3}\\.){3}\\d{1,3}\\b")) {
> thing = inetAddress.getHostAddress();
> }
> PApplet.println("IP address: " + inetAddress.getHostAddress());
> PApplet.println("thing : " + thing);
> }
> }
> } catch (SocketException ex) {
> PApplet.println("SocketException:" + ex.toString());
> } catch (NullPointerException nx) {
> PApplet.println("Failed to get any network interfaces...");
> }
> 
> //PApplet.println("IP address: " + inetAddress.getHostAddress());
> //PApplet.println("thing : " + thing);
> return thing;
> 
> ```
> 
> }

The source code has been modified as shown below.

> // && thing == “0.0.0.0”

I do not know the exact reason. ;;  
The obvious thing is that there is an error in the Android 9.0 version of the smartphone.

---

_[View the full topic](https://discourse.processing.org/t/ketai-library-ketainet-getip-error/11415)._
