GoogleTalkConnection XMPPError

Hi,

I eagerly downloaded Smack 2.0.0 a few minutes ago but I can’'t get a GoogleTalkConnection up - I always get “XMPPError connecting to talk.google.com:5222.: (502)” in construction of a new GoogleTalkConnection. I have smack.jar, smackx.jar on classpath, and my code is as simple as:

GoogleTalkConnection con = new GoogleTalkConnection();

con.login(“username”, “password”);

Chat newChat = con.createChat("jsmith@gmail.com");

newChat.sendMessage(“Howdy!”);

What could be going on? I am not running a firewall, I can connect to google talk using the username and pwd in google talk itself - the only other thing I can think of is that I’‘m using 1.4.1 java, it doesn’'t require 1.4.2 does it?

Many thanks

J

emm… i’‘m not a coder and Google Talk spec, but i’'m reading whole forum and i think you should not put @gmail.com, but just username. Not sure about this though.

think of is that I’‘m using 1.4.1 java, it doesn’'t

require 1.4.2 does it?

shouldnt it be 1.5.x?

Hi - this error occurs in constructing a GoogleTalkConnection, before the login or chat is attempted (judging by the other examples you LOGIN without the @gmail but you open chats to people with the @gmail, but hey, if only I could get that far)

previous versions have been 1.4.2, and as far as I know there hasn’'t been a change

Same with 1.4.2 - note that the doc says “The only requirement for Smack is JDK 1.2 or later”

Here is the exception I’'m getting - should have posted this originally:

XMPPError connecting to talk.google.com:5222.: (502)

– caused by: java.net.ConnectException: Connection refused: connect

at org.jivesoftware.smack.XMPPConnection.(GoogleTalkConnection.java:33)

at Jtest.main(Jtest.java:23)

Exception in thread “main”

Ok, having checked the smack code all it is doing at this point is:

java.net.Socket socket = new Socket(“talk.google.com”, 5222);

and when I execute that, I get:

java.net.ConnectException: Connection refused: connect

at java.net.PlainSocketImpl.socketConnect(Native Method)

at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)

at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)

at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)

at java.net.Socket.connect(Socket.java:452)

at java.net.Socket.connect(Socket.java:402)

at java.net.Socket.(Socket.java:124)

So this isn’‘t a smack thing - but I’‘m still none the wiser. I’'ve just tried to telnet to talk.google.com and it didnt let me (i.e. telnet talk.google.com 5222). Can anyone else do this? Maybe I am being blocked on this network somehow after all.

Thats wierd i was under the impression it should be 5223 but i am not positive on this fact.

jonv,

Do you have a firewall that is preventing you from using that port (5222)?

Regards,

Matt

previous versions have been 1.4.2, and as far as I

know there hasn’'t been a change

That is correct. Smack still only requires JDK 1.4.2.

-Matt

Hi guys - sorry for the hassle, it turns out we were blocking that port on our corporate firewall. Thanks for your help.