Re: Gtalk Connection Problems
From: Shashank Singh <shashank.sunny.singh@xxxxxxxxx>
Date: Sat, 3 Oct 2009 16:21:56 +0200 (CEST)
Thanks for the encouragement :P

It appears to me that gloox is not creating a secure socket for connection
on port 443. That should be the reason why talk.google.com:443 gives up and
closes the connection.Shouldn't there be a SSL handshake on such a
connection before the server responds to the XML request string sent?

I am no SSL expert and might be headed in a wrong direction
any ideas will be appreciated :)

On Sat, Oct 3, 2009 at 6:53 PM, madkoala <me@xxxxxxxxxxxx> wrote:

>  You should connect to talk.google.com:5222 (TLS connection).
>
> If port 5222 is blocked for you, then you can’t connect to google talk.
> Just give it up. L
>
>
>
> *From:* Shashank Singh [mailto:shashank.sunny.singh@xxxxxxxxx]
> *Sent:* Saturday, October 03, 2009 8:23 PM
> *To:* gloox-dev@xxxxxxxxxx
> *Subject:* [gloox-dev] Gtalk Connection Problems
>
>
>
> I am using gloox-0.9.9.9 on win32 built using Visual Studio 2008 (with
> openssl)
> I had to use a release build as debug build was throwing exception on
> creating a new JID (I can explain that too if required).
> The code below, to connect to gtalk does not work: I get a connection error
> (err 3: server closed connection).
> Port 5222 is blocked for me so 443 is the only option I have got.
>
> The output for the code is:
>
> bot created
> Log:0 This is gloox 0.9.9.9, connecting...
> Log:0 connecting to talk.google.com (72.14.203.125:443)
> Log:0 <?xml version='1.0' ?><stream:stream to='gmail.com'
> xmlns='jabber:client
> xmlns:stream='http://etherx.jabber.org/streams'  xml:lang='en'
> version='1.0'>
> on dis connect 3
>
> I have read this (rather old) thread on the list
> http://camaya.net/glooxlist/dev/msg00885.html where similar problem
> occurred due to absence of Openssl and the OP was able to get over it by
> building with openssl which as you can see
> doesn't help me.
>
> Any clues?
>
> #include <iostream>
> #include <client.h>
> #include <messagehandler.h>
> #include <connectionhttpproxy.h>
> #include <connectiontcpclient.h>
> #include <connectionlistener.h>
> using namespace gloox;
>
> class TestLogHandler: public LogHandler
> {
>     void handleLog(LogLevel level,
>                    LogArea area,
>                    const std::string & message)
>     {
>         std::cout<<"Log:"<<level<<" "<<message<<std::endl;
>
>     }
> };
>
> class Bot : ConnectionListener, public MessageHandler
> {
>  public:
>    Bot()
>    {
>       JID jid( "xxx@xxxxxxxxx/gloox" );
>
>       j = new Client( jid, "pwd", 443);
>       j->logInstance().registerLogHandler(LogLevelDebug, LogAreaAll, new
> TestLogHandler());
>
>       j->setServer("talk.google.com");
>
>       j->registerConnectionListener( this );
>       j->registerMessageHandler( this );
>       j->connect();
>    }
>    virtual void handleMessage( Stanza* stanza,
>                                MessageSession* session = 0 )
>    {
>      std::cout<<"message recvd\n"<<std::endl;
>      Stanza *s = Stanza::createMessageStanza(
>          stanza->from().full(), "hello world" );
>      j->send( s );
>    }
>
>    virtual void onConnect() {
>        std::cout<<"on connect"<<std::endl;
>    }
>
>    virtual bool onTLSConnect( const CertInfo& info ) {
>        std::cout<<"on tls connect"<<std::endl;
>        return true;
>    }
>    virtual void onDisconnect(ConnectionError e) {
>        std::cout<<"on dis connect "<<e<<std::endl;
>    }
>
>  private:
>    Client* j;
> };
>
>
> int main( int argc, char* argv[] )
> {
>   std::cout<<"bot created"<<std::endl;
>   Bot b;
>
> }
>
> --
> Regards
> Shashank Singh
> Senior Undergraduate, Department of Computer Science and Engineering
> Indian Institute of Technology Bombay
> shashank.sunny.singh@xxxxxxxxx
> http://www.cse.iitb.ac.in/~shashanksingh<http://www.cse.iitb.ac.in/%7Eshashanksingh>
>
> --
> gloox-dev mailing list
> to unsubscribe:
> send a message with subject 'unsubscribe gloox-dev' to
> minimalist@xxxxxxxxxx
>



-- 
Regards
Shashank Singh
Senior Undergraduate, Department of Computer Science and Engineering
Indian Institute of Technology Bombay
shashank.sunny.singh@xxxxxxxxx
http://www.cse.iitb.ac.in/~shashanksingh