zoukankan      html  css  js  c++  java
  • 可靠的双向管道和不可靠的双向管道

    在《JXTA JavaTM Standard Edition v2.5: Programmers Guide》的第17页中,介绍了JxtaSocket和JxtaBiDiPipe;根据该介绍,这两种通信机制都提供双向可靠的通信信道。

    但有时可能处于性能的考虑,我们希望使用类似UDP那种方式,而又不想使用低级管道(需要手工实现双向通信):

    这时可以仍然使用JxtaBiDiPipe,并调用其setReliable(false),将其 可靠性参数设置为false。

    一个使用场景就是通过RTP协议传输音频/视频(在自定义的传输层使用JXSE)。

    RTP协议本身是不可靠的,那么如果将RTP建立在可靠性协议(例如TCP)之上,会不会对性能有影响?

     不知到上面的分析是否正确?

    ————————————————————————————————————————————————————————————————

    查看JxtaBiDiPipe的源代码,将isReliable标志设置为true,确实多做了额外的工作

        /**
         * If {
    @code true} then we are using the underlying end-to-end ACK reliable
         * layer to ensure that messages are received by the remote peer.
         
    */
        protected volatile boolean isReliable = false;
        protected volatile ReliableInputStream ris = null;
        protected volatile ReliableOutputStream ros = null;


        /**
         * creates all the reliability objects
         
    */
        private void createRLib() {
            if (isReliable) {
                if (outgoing == null) {
                    outgoing = new OutgoingMsgrAdaptor(msgr, retryTimeout);
                }
                if (ros == null) {
                    ros = new ReliableOutputStream(group, outgoing, new FixedFlowControl(windowSize), group.getTaskManager().getScheduledExecutorService());
                }
                if (ris == null) {
                    ris = new ReliableInputStream(group, outgoing, retryTimeout, this);
                }
            }
        }
  • 相关阅读:
    编写 grunt 插件经验
    Sencha Touch 手机移动开发框架 HTML5 项目压缩方案;
    随笔 编辑推荐 上头条了, 贴出来做个记念!
    Javascript 俄罗斯方块 游戏代码解释!
    30天自制操作系统(NASM+GCC版)
    Logisim 打不开的解决方案(Windows10)
    Kali Linux 2020通过UEFI硬盘安装(免u盘)
    开源一个自制的ORM框架,基于Java原生JDBC(应该是全网首个吧)
    书单
    前端技术文章收集
  • 原文地址:https://www.cnblogs.com/cuizhf/p/2213859.html
Copyright © 2011-2022 走看看