问题描述
SCTP
具有本机多宿主支持,如果我正确理解,如果主接口出现故障,它将自动通过辅助NIC重新路由数据包.如果主NIC出现故障,我通过编写自定义路由守护程序来修改路由表,从而使用TCP复制了此功能.我想尝试使用SCTP
代替.
SCTP
has native multi-homing support which if I understand it correctly will automatically reroute your packets over a secondary NIC if the primary interface goes down. I duplicated this functionality with TCP by writing a custom routing deamon to modify the routing tables if my primary NIC goes down. I would like to try using SCTP
instead.
在Steven的 Unix网络编程V1第三版中,它说:
In Steven's Unix Network Programming V1 3rd Edition on page 288 it says:
现在,我已经尝试了此方法,但效果却很差.
Now I've tried this with fairly poor results.
我正在Ubuntu 9.04上运行,并安装了libsctp1,libsctp-dev和lksctp-tools软件包.我已经用lksctp-tools验证了SCTP
是否正常工作.
I'm running on Ubuntu 9.04 with the libsctp1, libsctp-dev, and lksctp-tools packages installed. I've verified with lksctp-tools that SCTP
is working properly.
我使用了 UNP示例代码,并按照~/unpv13e/tcpcliserv/tcpserv04.c
和程序.
I took the UNP example code and modified as indicated above the ~/unpv13e/tcpcliserv/tcpserv04.c
and ~/unpv13e/select/tcpcli02.c
programs.
这是一个简单的回显服务器/客户端对.服务器显然在侦听运行,但是客户端退出说连接被拒绝.由于netstat不支持SCTP
,因此我使用了lsof -n | grep tcpserv
向我显示:
This is a simple echo server / client pair. The server runs apparently listening, but the client exits saying the connection was refused. Since netstat doesn't support SCTP
I used lsof -n | grep tcpserv
which showed me:
tcpserv04 6208 alice 3u sock 0,4 33889 can't identify protocol
除了tcpserv04打开了某种套接字之外,这似乎并没有告诉我很多东西.
This doesn't seem to tell me much other than tcpserv04 has some kind of socket open.
我已经在perl中重写并测试了原始的TCP客户端,所以我将其切换为sctp并能够连接,尽管在stdin上传递文件并不能完全正常工作(挂接到文件的大约2/3挂起了)回声的背面).
I had already rewrote and tested the original TCP client in perl, so I switched it to sctp and was able to connect although piping a file on stdin didn't completely work ( hung about 2/3's of the way through receiving the echo's back ).
UNP似乎暗示将TCP应用程序移植到SCTP以利用多宿主是微不足道的,但是基于这种简单的尝试却似乎并非如此.
It seems like UNP is implying that porting TCP applications to SCTP to take advantage of multi-homing is trivial, yet based this simple attempt that doesn't really seem to be the case.
在将TCP应用程序移植到一对一样式的SCTP以便利用多宿主的情况下,有人能给我指出一个好的教程或对任何陷阱提供好的建议吗?
Can anyone point me to a good tutorial or give good advice on any gotcha's to watch out for when porting TCP apps to one-to-one-style SCTP to take advantage of multi-homing?
推荐答案
tcpcli02
尝试连接到端口7,而tcpserv04
侦听端口9877(SERV_PORT
的默认值).更改它们以使其匹配后,它对我有用.
tcpcli02
tries to connect to port 7, while tcpserv04
listens on port 9877 (the default value for SERV_PORT
). After changing those to match, it works for me.
通常,对SCTP的支持非常差.除非您控制要连接的主机之间的整个网络基础结构,否则我不能指望它能够可靠地工作.如UNP所述,移植应用程序本身应该没有任何麻烦.
Support for SCTP generally is very bad. Unless you control the entire network infrastructure between the hosts you are trying to connect, I would not count on it to work reliably.Porting the applications itself should be fairly hassle-free, as mentioned in UNP.
这篇关于带有多宿主的SCTP作为TCP的替代品的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!