Smack Connection and Contacts

HI, tried to connect a simple application based in smack protocol to a Jive Messenger running in a PC… for example with this IP: 69.25.68.15

XMPPConnection connection = new XMPPConnection(“69.25.68.15”);

connection.login(usuario, password);

but I have this error: Connection TIME OUT!

I could add-delete and see contacts with Smack package???

THANKS!

Hi Andres,

where do you get the timeout? While creating the connection or when you try to login?

Does “telnet 69.25.68.15 5222” creates a connection (enter “” to quit) or does it also fail?

Usually a firewall will block connection attempts and the server is running fine. Maybe you can install Wildfire (or the old Jive Messenger) on your local PC and try to connect to 127.0.0.1 - this should help you to check if your code if running fine.

LG

HI LG:

telnet didn’'t work. My server name is _____

servidor = “oscarserver”;

usuario=“andres31011”;

CODE:

XMPPConnection connection = new XMPPConnection(servidor);

System.out.println(“conexion exitosa”);

connection.login(usuario, password);

System.out.println(“login exitoso”);

ERROR:

ERROR: Could not connect to oscarserver:5222.: (504)

– caused by: java.net.UnknownHostException: oscarserver

AND if I put IP:

servidor=“69.79.49.148”

ERROR: XMPPError connecting to 69.79.49.148:5222.: (502)

– caused by: java.net.ConnectException: Connection timed out: connect

“WHILE CREATING THE CONNECTION”

THANKS A LOT!

You’'re server “oscarserver” needs to be resolved somehow. Add it to your hosts file, with the IP you are using.

Alex

Hi Andres,

so you get the timeout when you try to connect. I assume that there is a firewall (maybe WinXP build-in) between you and the server.

If telnet does not display something like “” then you should check the connection first.

LG

HI!

I tried installing wildfire server in my PC, and I do the connection and send messager… but I need to know, how I can add/deleted a contact from de server…

THANKS for your help!

Hi Andres,

you can use either the Wildfire admin interface, web pages /user-create.jsp and /user-summary.jsp or Smack:

XMPPConnection c = new XMPPConnection(servername);

AccountManager am = c.getAccountManager();

am.createAccount(username, password);

c.login(username, password);

AccountManager am2 = c.getAccountManager();

am2.deleteAccount();

/code

LG

hi! mmm, I’‘m sorry but I need to know is how i can add a contact to my friend’'s list.

THANKS!

You can add a Contact to your Roster by using Roster#createEntry

This will send a SUBSCRIBE request to the contact who can then either accept or decline your request.

Check the docuementation and Javadocs for more information

Jon