Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

XMPP/Jabber Client implementation

Hello

Im trying to implement a simple Jabber client app using C++.

I understand that connection, handshake and user login happens through XML message streams.

The code i have written is as follows :

1) open socket
iSocket = socket(AF_INET, iSocketType, 0);

2) connect to server hosted on same machine ie. localhost
if(connect(iSocket, (struct sockaddr*)&iSa, sizeof(iSa)) < 0)

3) server handshake
string str = "<?xml version='1.0'?> ";

int result = send(iSocket, str.c_str(), strlen(str.c_str()), 0);
while(true)
{
if(result <= 0)
break;
result = recv(iSocket, str2, strlen(str2), 0);
reply.append(str2);
}
reply is :
<?xml version='1.0'?>t'>t


My doubt is after this, any XML stream Im sending doesnt receive a reply

I have tried different combinations.
References :
http://java.sys-con.com/node/232087

I even tried to extract the id received from reply in step 3 and constructed the stream. Tried 127.0.0.1 instead of localhost.

Please help.
Sign In or Register to comment.