I added the permissions

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

to my Manifest. And my code looks like this:

public void sendMessageToServer() {
    try {
        Log.e("MainActivity", "sendMessageToServer - 1");
        int port = 11080;
        String serverIP = InetAddress.getByName("my-example-domain.com").toString();
        Log.e("MainActivity", "sendMessageToServer - 2 serverIP = " + serverIP);
        ... and so on ...

However, in the line InetAddress.getByName(...) my code gets stuck and does not continue.

The domain is 100% correct. What am I missing here?

Related posts

Recent Viewed