1、什么是资源
当你连接到一个Jabber服务器的时候,你需要提供一个“资源”。利用这个“资源”,服务器就能知道该如何向你(的客户端)发送消息及现场信息。当你连接到服务器时,你的地址是user@server.com/resource,而不是user@server.com,例如我在Jabber.cn服务器的账户是Lutts@jabber.cn/Exodus),有些Jabber客户端让你选择资源,如Exodus可以选择home,work等,有些是硬编码的(即你只需要提供user@server.com,而不需要提供资源,客户端自动添加)。借助于这个概念,你可以用两个不同的客户端(资源)同时边接到服务器,只要两个连接的资源不同即可,user@server.com部分可以是相同的)。这不像QQ等,一个账户不可以同时有两个以上的登录。
下面是在RFC 3920中关于资源的描述:
The resource identifier is an optional tertiary identifier placed after the domain identifier and separated from the latter by the '/' character. A resource identifier may modify either a <node@domain> or a mere <domain> address. It usually represents a specific session, connection (e.g., a device or location), or object (e.g., a participant in a multi-user chat room) belonging to the entity associated with a node identifier. A resource identifier is opaque to both servers and other clients, and is typically defined by a client implementation when it provides the information necessary to complete Resource Binding (Section 7) (although it may be generated by a server on behalf of a client), after which it is referred to as a "connected resource". An entity MAY maintain multiple connected resources simultaneously, with each connected resource differentiated by a distinct resource identifier.
A resource identifier MUST be formatted such that the Resourceprep profile of [STRINGPREP] can be applied without failing. Before comparing two resource identifiers, a server MUST (and a client SHOULD) first apply the Resourceprep profile to each identifier.
大致的意思是:资源标识符代表着一个属于(与结点标识(@前面部分)相关联的)实体的特定的会话或连接(例如:一个设备或是一个位置)或是一个对象(例如:一个多人聊天室的参与者)。
2、可以用Jabber同使用其他即时通讯服务的人聊天吗?
当然可以!可以通过"gateways"(网关,呵呵,还是不翻译的好)与其他的即时通讯软件,例如MSN,ICQ等通信。但是,"gateways"是在服务器上运行着的,但不是每个服务器都运行着(你期望的)那个gateway。关于如何在客户端安装gateway,请参见Jabber User Guide(Jabber用户手册) 。
(未完)