免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 7810 | 回复: 2
打印 上一主题 下一主题

寻TIPC中文资料无果,E文资料学习笔记 [复制链接]

论坛徽章:
84
每日论坛发贴之星
日期:2015-12-29 06:20:00每日论坛发贴之星
日期:2016-01-16 06:20:00每周论坛发贴之星
日期:2016-01-17 22:22:00程序设计版块每日发帖之星
日期:2016-01-20 06:20:00每日论坛发贴之星
日期:2016-01-20 06:20:00程序设计版块每日发帖之星
日期:2016-01-21 06:20:00每日论坛发贴之星
日期:2016-01-21 06:20:00程序设计版块每日发帖之星
日期:2016-01-23 06:20:00程序设计版块每日发帖之星
日期:2016-01-31 06:20:00数据库技术版块每日发帖之星
日期:2016-01-16 06:20:00程序设计版块每日发帖之星
日期:2016-01-16 06:20:00程序设计版块每日发帖之星
日期:2016-01-14 06:20:00
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-12-21 17:57 |只看该作者 |倒序浏览
Reliable High-Performance Protocols...
>TCP : designed for Internet – hides long latencies, retries.
>UDP : not reliable, RUDP doable but not in kernel.
>DCCP: Datagram Congestion Control Protocol ,
       didn't exist at the time, still early development.
>SCTP: (Stream Control) close but connection-oriented and
       focused on internet transport.
>TIPC: designed for LAN and Telco/Embedded Market.
(目前有vxWorks和linux版本) HomePage http://tipc.sourceforge.net/

端口的表示 port ID
{Z.C.N:ref}
The port ID is assigned
automatically by TIPC when the port is created, and consists of the 32-bit
network address of the port's node and a 32-bit reference value.  The
reference value is guaranteed to be unique on a per-node basis and will not
be reused for a long time once the port ceases to exist.

因为port ID是port创建时自动分配的,为了方便使用,tipc提供了port naming
机制,使我们可以将服务端口关联到一个指定的数值(port name)上   (bind)
port naming 只支持 server port
(Port names and name sequences are designed for use by server ports.  TIPC
does not allow a named sever port to initiate a connection (as if it were a
client port), nor does it allow the assignment of names to a connected client
port (as if it were a server port).)
port name组成 {type,instance}   (用 type instance 两元组关联一到多个服务端口)
    type 域0-63预留,编程时不要使用;
    同一个name可以绑定多个port,也可以一个port绑定多个name

port name sequence 表示一个名字区间/序列   (表示一个服务类型的一个端口序列/区间,适于多播等应用
{type,lower bound,upper bound}


Name Subscriptions
--------------------------
TIPC provides a network topology service that applications can use to receive
information about what port names exist within the application's network zone.
提供网络拓扑(查询/订阅)服务,可以查询/订阅 服务的地址,状态事件,,
An application accesses the topology service by opening a message-based
connection to port name {1,1} and then sending "subscription" messages to the
topology service that indicate the port names of interest to the application;
in return, the topology service sends "event" messages to the application when
these names are published or withdrawn by ports within the network.  
Applications are allowed to have multiple subscriptions active at the same
time; issuing a new subscription does not affect any existing subscription.


当消息发送的目的地不是port ID,而是port name时就需要把这个name转换
为对应的port ID,这个查询的过程对app是透明的,,
1.5.2 Source Routing
----------------------------
Once a message has been created, TIPC then determines what node the message
should be sent to.  If the specified destination address is a port ID, the
destination node is pre-determined; if the address is a port name, TIPC performs
a name table lookup to select a port (see 1.4.1 above), and then uses the node
associated with that port.  The message is then passed to a link for off-node
transmission (see 1.5.3 below) or is handed off to the destination port directly
if it is on the same node as the sender (see 1.5.5 below).

Problems that can arise during the source routine phase of message delivery:

- No matching port can be located during a name table lookup when sending by
  port name.
- No working link to the specified destination node can be found when sending
  by port ID.


[ 本帖最后由 yjh777 于 2009-12-21 20:44 编辑 ]

论坛徽章:
84
每日论坛发贴之星
日期:2015-12-29 06:20:00每日论坛发贴之星
日期:2016-01-16 06:20:00每周论坛发贴之星
日期:2016-01-17 22:22:00程序设计版块每日发帖之星
日期:2016-01-20 06:20:00每日论坛发贴之星
日期:2016-01-20 06:20:00程序设计版块每日发帖之星
日期:2016-01-21 06:20:00每日论坛发贴之星
日期:2016-01-21 06:20:00程序设计版块每日发帖之星
日期:2016-01-23 06:20:00程序设计版块每日发帖之星
日期:2016-01-31 06:20:00数据库技术版块每日发帖之星
日期:2016-01-16 06:20:00程序设计版块每日发帖之星
日期:2016-01-16 06:20:00程序设计版块每日发帖之星
日期:2016-01-14 06:20:00
2 [报告]
发表于 2009-12-22 10:51 |只看该作者
Server code:
struct sockaddr_tipc server, client;
int sd = socket (AF_TIPC, SOCK_RDM,0);
server.family = AF_TIPC;
server.addrtype = TIPC_ADDR_NAMESEQ;
server.addr.nameseq.type = 1010;
server.addr.nameseq.lower = 1;
server.addr.nameseq.upper = 1;
server.scope = TIPC_CLUSTER_SCOPE;
bind(sd, (struct sockaddr*)&server, sizeof(server)));
------------------------------------------------------------------
Client code:
int sd = socket (AF_TIPC, SOCK_RDM,0);
server.family = AF_TIPC;
server.addrtype = TIPC_ADDR_NAME;
server.addr.name.name.type = 1010;
server.addr.name.name.instance = 1;
server.addr.name.domain = 0;
if (wait_for_server(server.addr.name.name.type, 10000 /*ms*/) < 0)
    exit(EXIT_FAILURE);

论坛徽章:
84
每日论坛发贴之星
日期:2015-12-29 06:20:00每日论坛发贴之星
日期:2016-01-16 06:20:00每周论坛发贴之星
日期:2016-01-17 22:22:00程序设计版块每日发帖之星
日期:2016-01-20 06:20:00每日论坛发贴之星
日期:2016-01-20 06:20:00程序设计版块每日发帖之星
日期:2016-01-21 06:20:00每日论坛发贴之星
日期:2016-01-21 06:20:00程序设计版块每日发帖之星
日期:2016-01-23 06:20:00程序设计版块每日发帖之星
日期:2016-01-31 06:20:00数据库技术版块每日发帖之星
日期:2016-01-16 06:20:00程序设计版块每日发帖之星
日期:2016-01-16 06:20:00程序设计版块每日发帖之星
日期:2016-01-14 06:20:00
3 [报告]
发表于 2011-04-22 10:15 |只看该作者

[转]

本帖最后由 yjh777 于 2011-04-22 10:20 编辑

http://hi.baidu.com/6oo9/blog/it ... 70e2065a4e0aa6457fe
http://hi.baidu.com/6oo9/blog/it ... 70e2065a4e0aa6457fe

  仅为开发爱好者提供一些浅见,转载请注明出处。

  TIPC是爱立信的某个工程师弄出来的,后来开源了。这段时间我琢磨了一下,觉得这个玩意还真不错。TIPC是Transparent Interprocess Communication的缩写,即是进程间通信的一种协议,之所以冠之以Transparent,透明的,因为它发布了一层更为简洁实用的框架,让使用的人不再需要知道某个进程运行在哪一台机子上,就能够和与这个进程通信。TIPC本质上是用socket实现的,而且现在已经成为linux内核的一部分,足以见得是好东西。

  平时我们使用的socket,TCP也好,UDP也好,用来标识一对socket的通信,无非是用两个socket的IP地址和端口号。比如使用UDP的socket,要发一个datagram到另一个socket,需要指定对端的地址,这个地址是由那台机的IP和端口组成。socket是在内核中管理,当内核检测到socket有数据可读时,就会通知拥有这个socket的进程去读取里面的数据。

  这里的不方便之处在于,要指定对端地址,我们必须知道这个socket在哪台机,端口是多少,才能发送数据出去。能不能只提供一些应用层的信息,就可以让内核自己去查到socket的位置,再把消息发过去?TIPC做的就是这样的事。使用TIPC,我们在创建socket的时候在内核中注册自己的服务类型service type,那么在发送端,只需要指定服务类型就可以由内核路由到相应的socket。这个时候,对应用层来说,对端地址仅仅是一个服务类型service type!很显然,内核维护着这么一张TIPC的路由表,即由服务去查找socket。而每台机都有这样的路由表,他们之间信息就像能够共享一样地为整个集群的TIPC socket服务。有了TIPC,这个socket使用了哪个IP,那个端口,我们都不再需要知道,很好很强大。

  TIPC的其他的特性还有:

  1. 有些时候多个进程提供同样的服务,仅仅是为了负载平衡或其他原因,这种情况可以用一个整数变量instance来标识不同socket,但是指定同样的service type。这个时候socket的地址是由service type和instance共同来指定。发送数据时候只需要指定service type和一个instance的值,也可以指定service type和instance的一个区间。对于后者,就是broadcast你的datagram。

  2. 管理前面说的TIPC路由表的是内核当中的一个进程叫做name server。它知晓着集群中所有的TIPC socket。在发送datagram给服务某个service的socket之前,你可以向它请求服务这个service的socket是否已经在工作了,它会告诉你service的状态。并且注册了一个observer,当你关心的socket起来之后发消息通知你,这样就可以避免你把datagram发给一个根本不存在的socket。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP