Git Product home page Git Product logo

Comments (2)

laksg2009 avatar laksg2009 commented on June 6, 2024

SocketChannelClient类
registerNetworkMonitor()函数,会存在场景问题.
例如我创建socket后.我想点击连接的时候才去连接这个socket,因为registerNetworkMonitor这个函数最终会回调startReconnect这个函数,所以导致我没有电开始链接socket的情况下会一直死循环重链.

from androidsocketcore.

jacklongway avatar jacklongway commented on June 6, 2024

@laksg2009
第一个问题: private static final LinkedList mObservable = new LinkedList(); 等价于private static final LinkedList mObservable = new LinkedList<>(); 在修复版本中,已经说明,可以去看看详细的回答

第二个问题:之所以那么处理有几个原因:

  1. 保证程序的稳定性,基础性的东西,即使看上去不为空,但是最好还是判空处理,避免暴力反射,code attack等问题的出现,这里注意就好。
  2. 之所以不用迭代器直接处理,这里考虑数组与链表的差异性,注册直接链表,这个动作是插入,性能优越于数组,通知是一种查询操作,数组是线性存储的,查找性能优越于链表,所以这里用空间换时间的方式,实现调优处理,这里注意一下就好。

第三个问题: int type = intent.getIntExtra(ConnectivityManager.EXTRA_NETWORK_TYPE, -1); 这个方法apilevel 1就有了,这个是intent`里面的方法,自行查阅官方文档查看属于的api level。

第四个问题: SocketChannelClient 在一些场景的问题,确实存在,1.0.1版本已经修复,修复版本中也添加了详细注释,可以去看看。最后还说一下,一般socket场景的应用都是需要长时间后台运行的,可能涉及到后台保活的需求,可以查看我写的保活服务基础组件,链接: daemon

from androidsocketcore.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.