java.net.UnknownHostException beim Verbinden des openfire xmpp Servers
Ich bin ein Anfänger für Chat-App. Ich habe angefangen, mich mit Chat-Apps zu befassen. Ich versuche, ein virtuelles Android-Gerät mit einem OpenFire-XMPP-Server zu verbinden, kann aber keine Verbindung herstellen. Ich erhalte java.net.UnknownHostException. Kann mir jemand bei der Verbindung meines Android-Geräts helfen? Top xmpp server
Der von mir verwendete Code lautet:
ConnectionConfiguration config = new ConnectionConfiguration("pc" ,5222);
/*ConnectionConfiguration config =
new ConnectionConfiguration("192.168.0.1",5222,"pc");*/
/*config.setCompressionEnabled(true);
config.setSASLAuthenticationEnabled(true); */
config.setSecurityMode(SecurityMode.disabled);
config.setDebuggerEnabled(true);
config.setSASLAuthenticationEnabled(false);
XMPPConnection connection = new XMPPConnection(config);
Log.i("", "before connecting");
connection.connect();
Log.i("", "after connecting");
//connection.login("test", "test");
if(connection.isConnected()){
System.out.println("connection built");
connection.disconnect();
}
in Manifest:
<uses-permission android:name="android.permission.INTERNET"/>
und Logcat Ich habe mit java.net.UnknownHostException.