zoukankan      html  css  js  c++  java
  • xmpp笔记2(客户端到服务器的例子)--xml

    xmpp(

    客户端到服务器的例子

    )

    1 步:客户端初始流给服务器: <stream:stream

    xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' to='example.com'
    version='1.0'>

    步 2:服务器以发送给客户端一个流标记作为响应: <stream:stream

    xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' id='c2s_123'
    from='example.com'
    version='1.0'>

    步 3:服务器发送 STARTTLS 扩展给客户端,并带有认证机制与任何其它流特征: <stream:features>

    <starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'> <required/>

    </starttls>
    <mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>

    <mechanism>DIGEST-MD5</mechanism>

    <mechanism>PLAIN</mechanism> </mechanisms>

    </stream:features>
    步 4:客户端发送 STARTTLS 命令给服务器:

    <starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/> 步 5:服务器通知客户端它被允许处理

    <proceed xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
    步 5(替代):服务器通知客户端 TLS 协商失败,并关闭流与 TCP 连接:

    <failure xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>

    </stream:stream>
    步 6:客户端与服务器试图协商通过现存的 TCP 连接 完成 TLS 协商。 步 7:如果 TLS 协商成功,客户端初始化一个新流给服务器:

    <stream:stream xmlns='jabber:client'

    xmlns:stream='http://etherx.jabber.org/streams' to='example.com'
    version='1.0'>

    步 7(代替 ):如果 TLS 协商不成功,服务器关闭 TCP 连接。
    步 8:服务器靠发送带有任何可利用流特征的流头给客户端作为响应。

    <stream:stream xmlns='jabber:client'

    xmlns:stream='http://etherx.jabber.org/streams' from='example.com'
    id='c2s_234'
    version='1.0'>

    <stream:features>
    <mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>

    <mechanism>DIGEST-MD5</mechanism> <mechanism>PLAIN</mechanism>

    <mechanism>EXTERNAL</mechanism> </mechanisms>

    </stream:features>
    步 9:客户端继续 SASL 协商(6)

      

    【微分享】:障碍与失败,是通往成功最稳靠的踏脚石,肯研究、利用它们,便能从失败中培养出成功。

  • 相关阅读:
    OC之runtime面试题(一)
    OC之runtime的(isKindOfClass和isMemberOfClass)
    OC之runtime(super)
    OC中的__block修饰符
    iOS录音及播放
    webpack5升级过程遇到的一些坑?
    (转)iOS工具--CocoaPods 安装使用总结
    iOS学习--NSObject详解
    iOS学习--通过ipa包如何获取图片资源
    ‘A downloaded software component is corrupted and will not be used. ‘ while publish an iOS app to apple store via Xcode
  • 原文地址:https://www.cnblogs.com/supersr/p/5291699.html
Copyright © 2011-2022 走看看