AnsweredAssumed Answered

Cant connect on eJabberd server by smack

Question asked by Gustavo on Sep 17, 2015

I´m trying to connect on my XMPP server (ejabberd) using smack.

 

I using this code

 

XMPPTCPConnectionConfiguration config = XMPPTCPConnectionConfiguration.builder()

  .setUsernameAndPassword("teste2", "test2e")

  .setServiceName("10.0.2.2")

  .setHost("10.0.2.2")

  .setPort(5222)

  .build();

  AbstractXMPPConnection conn2 = new XMPPTCPConnection(config);

 

 

 

 

  try {

  c.connect();

  Log.i("XMPPChatDemoActivity",

  "Connected toooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo " + conn2.getHost());

  } catch (SmackException e) {

  e.printStackTrace();

  } catch (IOException e) {

  e.printStackTrace();

  } catch (XMPPException e) {

  e.printStackTrace();

  }

 

 

 

But, something get wrong.

 

org.jivesoftware.smack.XMPPException$StreamErrorException: host-unknown You can read more about the meaning of this stream error at http://xmpp.org/rfcs/rfc6120.html#streams-error-conditions

    <stream:error><host-unknown xmlns='urn:ietf:params:xml:ns:xmpp-streams'/></stream:error>

 

 

Im sure that the server is running in my localhost.

Outcomes