xmpp协议分析

 

连接服务器:

 

SENT: <stream:stream to="jabber.cn" xmlns="jabber:client" xmlns:stream="http://etherx.jabber.org/streams" version="1.0" >
RECV: <?xml version='1.0'?><stream:stream xmlns:stream='http://etherx.jabber.org/streams' id='43FEAEE5' xmlns='jabber:client' from='jabber.cn' version='1.0'>
RECV: <stream:features><register xmlns='http://jabber.org/features/iq-register'/><auth xmlns='http://jabber.org/features/iq-auth'/></stream:features>

 

登录(身份验证):

 

SENT: <iq id="jcl_103" type="get"><query xmlns="jabber:iq:auth"><username>renziyi</username></query></iq>
RECV: <iq id='jcl_103' type='result'><query xmlns='jabber:iq:auth'><username>renziyi</username><digest/><password/><resource/></query></iq>
SENT: <iq id="jcl_104" type="set"><query xmlns="jabber:iq:auth"><username>renziyi</username><resource>Exodus</resource><digest>2ee43612345655d3279a45227ede2969c7</digest></query></iq>
RECV: <iq id='jcl_104' type='result'/>

 

下载好友名单:

 

SENT: <iq id="jcl_105" type="get"><query xmlns="jabber:iq:roster"/></iq>

RECV: <iq id='jcl_105' type='result' from='[email protected]/Exodus'><query xmlns='jabber:iq:roster'><item jid='[email protected]' name='renzy' subscription='to'><group>Friends</group></item></query></iq>

 

更改自己状态为上线:
SENT: <presence><c node="http://exodus.jabberstudio.org/caps" ver="0.9.1.0" xmlns="http://jabber.org/protocol/caps"/><status>Available</status><priority>1</priority></presence>

你可能感兴趣的:(C++,c,xml,C#)