I am using Smack 2.2.0 (w/ JDK 1.5) and attempting to connect to GTalk services. I am working from behind a proxy server, and so I have set up the necessary proxy settings (as system properties). When I attempt to login, i get the following error stack:
Looking at the thread http://www.jivesoftware.org/community/thread.jspa?messageID=102946𙈢 , i guess, SMACK should make a check if a proxy has been defined in the system properties before opening the socket connection. If a proxy has been defined, then it should create a Socket object with the proxy information and then open the connection to the destination server.
I dont think it does. I set properly the proxy settings (with proxyHost, proxySet and proxyPort) and also tried a normal URLConnection to make sure it is working from behind my proxy server. However I get the same problem of connection timed out when I try a Google Talk connection from Smack. (Normal google talk client works through my proxy)
You can’‘t use Smack for google talk directly, since it doesn’‘t do the SRV resolve (which is absolutely required). You have to do that first and pass the host to Smack (don’‘t try to use Smack’‘s own SRV resolver, it’'s broken).
Could you indicate what I have to do in my code to
use the package you are saying and get Smack to use
it?
Well, I’‘m developing a client in Objective C, and so I’‘m using a C-based library. The code I’'m using is available at http://trac.adiumx.com/browser/branches/summer_of_code_2006/andreas_monitzer/Plu gins/Smack%20Service/SmackXMPPAccount.m?rev=16241#L318 (note that this forum breaks the URL, you have to join the lines). However, there are Java bindings available for that library, too.
Maybe you could indicate the steps I have to make? I am trying to use the package at www.dnsjava.org to get SRV records, but I have no idea what to do with them.
Do I still have to set the System properties to connect through the proxy? Does smack consider them? What do I have to do then, use the records that I get from the SRV DNS query and use them in the XMPP connection instead of talk.google.com.
An SRV record basically says for example “if you want to connect to the service xyz.com using the xmpp-protocol, you have to go to the server with the name jabber.xyz.com at port 5222”. The host you supply to Smack’'s ConnectionConfiguration is only resolved using A-records, which are the mapping server name -> IP.
What you have to do is to get the server name and port using the part of the user-supplied jabber id after the ‘’@’’. Then you can supply that server name and port to the connection configuration and use Smack with it. (of course, when the SRV-record cannot be obtained, you have to supply some sane replacement)