Git Product home page Git Product logo

androidsocketcore's People

Contributors

jacklongway avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

androidsocketcore's Issues

纯属个人强迫症

NetworkMonitorReceiver类

private static final LinkedList mObservable = new LinkedList();
改为:
private static final LinkedList mObservable = new LinkedList<>();
这样就不会有橙色的警告了.看着也舒服了...哈哈

还有if (networkMonitors != null) {
报警告,此判断语句永远为真,我认真看了看发现也确实是这样.
如果改成这样可以吗????
private void notifyNetworkMonitor(boolean success, int type, String reason) {
synchronized (mObservable) {
for (NetworkMonitor chine : mObservable) {
if (success) {
chine.onConnect(type);
} else {
chine.onDisconnected(reason);
}
}
}
}

3.int type = intent.getIntExtra(ConnectivityManager.EXTRA_NETWORK_TYPE, -1);
这个方法没有指明API使用级别为16以上.我设备是14,所以这里老是会判断为无网络.这是错误的判断.

项目无法正常运行

1):R文件引用包位置错误导致
2):一直报空,要么判空下,要么把start提前在各种监听之前运行.
3):发送数据编码无法改变.
4):ping的数据很不稳定,服务器不是每隔X秒后收到ping的数据,而是不确定时间收到不确定的ping条数据........
5):如果服务器主动端口连接的话会导致SocketChannelClient类中的while (iterator.hasNext())死循环.

发送数据太大得问题

发送数据太大数据发送不全对方无法获取全部数据
百度搜索后找到解决办法(但不知为何要sleep),
此方法在SocketChannelClient类里,.
void writeMessageToServer(byte[] msg) throws Exception {
if (isConnected()) {
// mSocketChannelClient.write(ByteBuffer.wrap(msg));
ByteBuffer wrap = ByteBuffer.wrap(msg);
if (wrap != null) {
while (wrap.hasRemaining()) {
int len = mSocketChannelClient.write(wrap);
Thread.sleep(500);
if(len < 0){
throw new Exception();
}
if(len == 0){
break;
}
}
}
}
}

测试环境,图片转Base64后(700多KB)发送给服务器.就会出现这个问题.系统版本安卓4.0.1

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.