XML Development

Moderators: None (Apply to moderate this forum)
Number of threads: 257
Number of posts: 456

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
XMPP/Jabber Client implementation Posted by yannifan on 22 Dec 2010 at 5:59 AM
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'?> <stream to='192.168.2.3:5222' xmlns='jabber:client'/>";

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'?><stream:stream xmlns:stream='http://etherx.jabber.org/streams' id='1d01dbe8470a1700077872538724988a227c4f54' from='5222' xmlns='jabber:client'>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.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.