Great work, connect() returns true, quits immediately
From: Amol <babaiscool@xxxxxxxxx>
Date: Wed, 02 Jul 2008 17:20:50 +0200
Hi,

This morning I started thinking about automating certain messaging tasks.
After, few perl scripts, Net::XMPP, I have landed right here. On gloox. The
build on Win32 went smooth. I built a sample app as well. It runs.

My congratulations and thanks for building such a great lib.

Like all the stuff in life, I have glitches. My sample app code is below. It
quits right after the connect() call. I traced thorugh the code. The
connect() call returns true and quits immediately.

On netstat, I see only http connection to one of the google talk servers. No
https connection. (I figure I should see an https ESTABLISHED connection).

>>>>code start

#include <client.h>
#include <messagehandler.h>

using namespace gloox;

class Bot : public MessageHandler
{
 public:
   Bot()
   {
      JID jid( "my_id@xxxxxxxxxxxxxxx/resource" );
      j = new Client( jid, "my_pass" );
      j->registerMessageHandler( this );
      j->setPresence( PresenceAvailable, 5 );
      j->setPort(80);
      j->connect();

   }

   virtual void handleMessage( Stanza* stanza,
                               MessageSession* session = 0 )
   {
     Stanza *s = Stanza::createMessageStanza(
         stanza->from().full(), "hello world" );
     j->send( s );
   }

 private:
   Client* j;
};

int main( int argc, char* argv[] )
{
  Bot b;
}

<<<<code end


I made some changes to make the recv() call myself. It loops forever. And
handleMessage() never gets called. I tried sending messages to this ID using
another one, still no luck.

>>>>code start

      j->setTls(TLSPolicy::TLSRequired);
       j->connect(false);

      while(1)
      {
          j->recv();
      }

<<<<code end

It'll be great if somebody can show me the way.

Thanks,
Amol.
-- 
gloox-dev mailing list
to unsubscribe:
send a message with subject 'unsubscribe gloox-dev' to minimalist@xxxxxxxxxx