“InetAddress” don't work in Android but it works in netbeans

legat

New member
Oct 16, 2013
2
0
0
Goal:
Use host adress using InetAddress.

Problem:
Why does the code not working in android studio? The same syntax code works at at netbeans.

What part am I missing?

Thank you!

Info:
*I'm new in android
*I'm using API 23
*I also have tried "getByName" but it doesn't work

AndroidManifest.xml


<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.jfdimarzio.test1">

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

</manifest>

public class Client
{

}