為了解決公共網(wǎng)絡(luò)與私有網(wǎng)絡(luò)的穿透問(wèn)題,Ice提出了在單個(gè)tcp連接上的雙向傳輸方式
一直以來(lái)對(duì)于Server端主動(dòng)發(fā)送Rpc請(qǐng)求到Client端的應(yīng)用我就一直很小心的使用bidirection方式,甚至是徹底不用,
因?yàn)橥ㄟ^(guò)驗(yàn)證發(fā)覺(jué)要使用bid則必須關(guān)閉ACM管理,也就意味著這個(gè)tcp連接是個(gè)長(zhǎng)連接,只有在這個(gè)長(zhǎng)連接上server才能
發(fā)起對(duì)客戶(hù)端的rpc調(diào)用,但如果連接斷了呢,client到server的rpc請(qǐng)求很簡(jiǎn)單,ice會(huì)重新發(fā)起連接,但之后的server到client的
rpc請(qǐng)求就不行了,這樣必須要求client再次初始化bid操作:
1 proxy->ice_getConnection()->setAdapter(adapter);
2 proxy->addClient(ident);
這個(gè)也太可怕了,Ice是不要求客戶(hù)直接管理底層的通信連接細(xì)節(jié)的,所以客戶(hù)不容易知道是否被重新連接
所以這個(gè)咚咚我個(gè)人覺(jué)得是雞肋,不知大家如何看同
Limitations
Bidirectional connections have certain limitations:
• They can only be configured for connection-oriented transports such as TCP and SSL.
1168 Connection Management
• Most proxy factory methods have no effect on a proxy created by a connection’s
createProxy operation. The proxy is bound to an existing connection,
therefore the proxy reflects the connection’s configuration. For example, it is
not possible to change the timeout value of such a proxy. Similarly, it is not
possible to change the proxy’s security configuration: if the incoming connection
is secure, then the proxy must be secure, and cannot be changed to be
insecure. However, it is legal to change between oneway and twoway invocations.
• A connection established from a Glacier2 router to a server is not configured
for bidirectional use. Only the connection from a client to the router is bidirectional.
However, the client must not attempt to manually configure a bidirectional
connection to a router, as this is handled internally by the Ice run time.
• Bidirectional connections are not compatible with active connection management
(see Section 37.4).