Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

连接成功,但是连接完会出现这个异常退出,请问什么原因? #194

Open
yecaler opened this issue Jun 1, 2021 · 5 comments

Comments

@yecaler
Copy link

yecaler commented Jun 1, 2021

异常信息如下:
com.xuhao.didi.core.exceptions.ReadException: com.xuhao.didi.core.exceptions.ReadException: read head is wrong, this socket input stream is end of file read -1 ,that mean this socket is disconnected by server

@yecaler
Copy link
Author

yecaler commented Jun 1, 2021

2021-06-01 21:54:19.678 9048-9322/com.xuhao.android.oksocket W/System.err: com.xuhao.didi.core.exceptions.ReadException: com.xuhao.didi.core.exceptions.ReadException: read head is wrong, this socket input stream is end of file read -1 ,that mean this socket is disconnected by server
2021-06-01 21:54:19.679 9048-9322/com.xuhao.android.oksocket W/System.err: at com.xuhao.didi.core.iocore.ReaderImpl.read(ReaderImpl.java:103)
2021-06-01 21:54:19.679 9048-9322/com.xuhao.android.oksocket W/System.err: at com.xuhao.didi.socket.client.impl.client.iothreads.DuplexReadThread.runInLoopThread(DuplexReadThread.java:35)
2021-06-01 21:54:19.679 9048-9322/com.xuhao.android.oksocket W/System.err: at com.xuhao.didi.socket.common.interfaces.basic.AbsLoopThread.run(AbsLoopThread.java:47)
2021-06-01 21:54:19.679 9048-9322/com.xuhao.android.oksocket W/System.err: at java.lang.Thread.run(Thread.java:764)
2021-06-01 21:54:19.680 9048-9322/com.xuhao.android.oksocket W/System.err: Caused by: com.xuhao.didi.core.exceptions.ReadException: read head is wrong, this socket input stream is end of file read -1 ,that mean this socket is disconnected by server
2021-06-01 21:54:19.681 9048-9322/com.xuhao.android.oksocket W/System.err: at com.xuhao.didi.core.iocore.ReaderImpl.readHeaderFromChannel(ReaderImpl.java:113)
2021-06-01 21:54:19.682 9048-9322/com.xuhao.android.oksocket W/System.err: at com.xuhao.didi.core.iocore.ReaderImpl.read(ReaderImpl.java:41)
2021-06-01 21:54:19.682 9048-9322/com.xuhao.android.oksocket W/System.err: ... 3 more

@o0King0o
Copy link

可以将ByteBuffer强制转化为Buffer,再调用。

@github201407
Copy link

@yecaler 问下,有解决了么,可否分享下处理方法

@o0King0o
Copy link

@yecaler 问下,有解决了么,可否分享下处理方法
这不就解决了吗,上面的方式!

@github201407
Copy link

可以将ByteBuffer强制转化为Buffer,再调用。
@o0King0o 看源码位置int value = mInputStream.read(bytes); value == -1报错,没理解这个转换
源码位置

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants