powered by Jive Software

Smack 3.0.4 not compatible with Google Talk

Hi,

I am trying to connect to google talk with he help of smack 3.0.4, using Eclipse 3.2 and JDK 1.5 my code is as follows


import org.jivesoftware.smack.ConnectionConfiguration;+

import org.jivesoftware.smack.XMPPConnection;

import org.jivesoftware.smack.XMPPException;

import org.jivesoftware.smack.packet.Message;

public class GoogleTalk {

public static void main(String[] args) throws XMPPException {

ConnectionConfiguration connectionConfig = new ConnectionConfiguration(“talk.google.com”,5222,“gmail.com”);

XMPPConnection connection = new XMPPConnection(connectionConfig);

connection.connect();

}

}


I got the following error and have following three questions

Q1: Is Smack3.0.4 not compatible with google talk?

Q2: Google says that SASL Plain protocol is required to connect to google talk … how to use that?

Q3: I have seen google’s C++ code to connect to google talk in which they have set host as gmail.com and service as talk.google.com but in the smack API it is reversed

ConnectionConfiguration connectionConfig = new ConnectionConfiguration(“talk.google.com”,5222,“gmail.com”);

We are passing “talk.google.com” as host and “gmail.com” as service name … why?

Kindly answer all the three questions …-----

Exception in thread “main” XMPPError connecting to talk.google.com:5222.: remote-server-error(502) XMPPError connecting to talk.google.com:5222.

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

  • at org.jivesoftware.smack.XMPPConnection.connectUsingConfiguration(XMPPConnection. java:830)+

  • at org.jivesoftware.smack.XMPPConnection.connect(XMPPConnection.java:1276)+

  • at GoogleTalk.main(GoogleTalk.java:10)+

Nested Exception:

java.net.ConnectException: Connection refused: connect

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

  • at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)+

  • at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)+

  • at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)+

  • at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)+

  • at java.net.Socket.connect(Socket.java:516)+

  • at java.net.Socket.connect(Socket.java:466)+

  • at java.net.Socket.<init>(Socket.java:366)+

  • at java.net.Socket.<init>(Socket.java:179)+

  • at org.jivesoftware.smack.XMPPConnection.connectUsingConfiguration(XMPPConnection. java:815)+

  • at org.jivesoftware.smack.XMPPConnection.connect(XMPPConnection.java:1276)+

  • at GoogleTalk.main(GoogleTalk.java:10)+


Hi,

I have a simple test client written as follows. It used to work. But when I run it now, it doesn’t seems to work.

/sumedha

import org.jivesoftware.smack.Chat;

import org.jivesoftware.smack.ChatManager;

import org.jivesoftware.smack.ConnectionConfiguration;

import org.jivesoftware.smack.MessageListener;

import org.jivesoftware.smack.XMPPConnection;

import org.jivesoftware.smack.XMPPException;

import org.jivesoftware.smack.packet.Message;

public class GtalkTest2 {

public static void main(String[] args) {

ConnectionConfiguration connectionConfig = new ConnectionConfiguration(“talk.google.com”,5222,“gmail.com”);

XMPPConnection connection = new XMPPConnection(connectionConfig);

try {

connection.connect();

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

ChatManager chatmanager = connection.getChatManager();

Chat newChat = chatmanager.createChat(“anotherusername”, new MessageListener() {

public void processMessage(Chat chat, Message message) {

System.out.println("Received message: " + message.toXML());

}

});

newChat.sendMessage(“Howdy”);

} catch (XMPPException e) {

e.printStackTrace();

}

System.out.println(“done!!!”);

}

}