LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   chat client with gloox in c++ (https://www.linuxquestions.org/questions/programming-9/chat-client-with-gloox-in-c-903797/)

tarunchawla 09-19-2011 04:21 AM

chat client with gloox in c++
 
here I have written this code and when after compiling I run it ,it does not show connection is established or not please help me.....
connect here returns true but why onconnect function is not called


#include<iostream>
#include<gloox/jid.h>
#include<gloox/connectionlistener.h>
#include<gloox/client.h>

using namespace std;
using namespace gloox;
class client:public ConnectionListener
{
public:
void start();
virtual bool onTLSConnect(const CertInfo& Info);
virtual void onConnect();
virtual void onDisconnect(ConnectionError e);
};
void client::onDisconnect(ConnectionError e){

}
void client::start()
{
JID *id=new JID("your email id");
//id->setServer("talk.google.com");
Client *cl=new Client(*id,"password");
cl->registerConnectionListener(this);
cl->connect();
}
void client::onConnect()
{
cout<<"connectoin established";
}


bool client::onTLSConnect(const CertInfo& Info)
{
cout<<"ok";
return true;
}
int main()
{
client c;
c.start();
}

compile it as g++ cliet.cpp -o cliet.o -lgloox -lpthread


All times are GMT -5. The time now is 03:18 PM.