gpt4 book ai didi

android - 如何中止 LocalServerSocket.accept

转载 作者:行者123 更新时间:2023-11-30 04:25:55 28 4
gpt4 key购买 nike

如何中止/中断 LocalServerSocket 在后台线程中等待方法 LocalServerSocker.accept() 中的连接?

我试过从另一个线程调用 close() 方法,但它似乎不起作用。

最佳答案

Android项目中为其开工单:http://code.google.com/p/android/issues/detail?id=29939 .

似乎问题已被 Google 确认,因为第一条评论是:

i think we should rewrite this to use the same underlying libcore stuff, and get the interruption behavior for free.

解决方法是从另一个线程向 LocalServerSocket 发送自定义关闭命令以取消阻止接受。

关于android - 如何中止 LocalServerSocket.accept,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8525730/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com