协议与实现的关系,仅对XMPP

现在我发现我写的IM系统已经完全无法修改成符合XMPP协议了,原因是根据XMPP的定义或者说约定俗成,inbound和outbound的XML stream都是在一个TCP连接中完成的,或者是http的polling。。。而我,为了不在服务器端维护太多的工作线程,采用的是inbound 和 outbound分离的 tcp 连接,这点基于rt_event 并不是象听起来那样困难,要说我之所以有这样好像莫名其妙的想法,还是是受 COM+和 EJB 的影响,大家都说有状态session不好的,占用资源,完事了写到数据库去好了,blablabla 。。。。。于是我就想,嗯,应该每次传完一次tag就关闭好了,线程可宝贵着呐。。。当时我还纳闷那么多客户端服务器要是底层都实现的不一样怎么通信。。事实上维持协议的简单,底层的问题交底层做才是正道啊,线程?多搬几台机器来就好了。。。 

4.2.  Binding to TCP

   Although there is no necessary coupling of an XML stream to a [TCP]
   connection (e.g., two entities could connect to each other via
   another mechanism such as polling over [HTTP]), this specification
   defines a binding of XMPP to TCP only.  In the context of
   client-to-server communications, a server MUST allow a client to
   share a single TCP connection for XML stanzas sent from client to
   server and from server to client.  In the context of server-to-server
   communications, a server MUST use one TCP connection for XML stanzas
   sent from the server to the peer and another TCP connection
   (initiated by the peer) for stanzas from the peer to the server, for
   a total of two TCP connections.

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值