-
Notifications
You must be signed in to change notification settings - Fork 596
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
android6.0传输异常 #5
Comments
Opps... 这个库是我 fock 别人的,您可以使用我们滴滴开源的 Socket 库 OkSocket 来完成您的业务需求 |
@hardstruglling |
今天debug查看下代码,是接收端接收到发送端通过udp发来的消息调用了关闭socket的方法,致使socket连接中断,不知道您当时为什么会调用关闭socket方法,是担心阻塞下一次的文件传输还是有其它什么左右作用? |
1.请贴出代码块==》》接收端接收到发送端通过udp发来的消息调用了关闭socket的方法~ |
在等待接收界面ReceiverWaitingActivity中调用startFileReceiverServer()方法
// FileInfo fileInfo = FileInfo.toObject(msg); |
按照流程来讲的话,closeSocket()只是关闭了传输文件列表的mDatagramSocket,不管文件实际传输的问题~你再排查一下,先用Android6.0或者其他机型的手机测试一下先 |
@mayubao 在Handler接收的消息处理中如果注释了不调用finishNormal真机测试每次都可以正常传输,如果调用了finishNormal真机测试十几次最多也就一次可以正常传输 |
这个问题我也没查到什么原因造成的,FileReceiverActivity界面才会开启ServerSocket,FileSenderActivity开启Socket进行数据传输,但是只要ReceiverWaitingActivity中调用了finishNormal或者直接finish界面,FileSender都会报SocketException异常,而ReceiverWaitingActivity跳转界面的时候什么操作都不做,则可以正常传输 |
@mayubao 担心资源没有及时回收 可以在FileReceiverActivity中当文件接收完后给ReceiverWaitingActivity发送一个广播去关闭socket |
可以的,只要逻辑走的通就行~ |
两台android6.0真机,开启热点接收文件,发送端点击发送文件,发送端有时会报SocketException,传输就中断了,测试了6次,只有一次传输成功
The text was updated successfully, but these errors were encountered: