首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在logCat中获取"[CDS] shutdownInput in read“

在logCat中获取"[CDS] shutdownInput in read“
EN

Stack Overflow用户
提问于 2014-07-03 19:15:03
回答 1查看 1.7K关注 0票数 3

我有一个我正在开发的android应用程序,在某个阶段,我得到了

是否在我的日志查看器中持续显示" [CDS]shutdownInput in read "

这需要什么?我做错了什么才导致这条消息出现?

我有一个检查in流的线程。

代码语言:javascript
复制
Thread thread = new Thread(new Runnable() {
        public void run() {
            while (true) {
                mySocket.ReadFromSocket();
                try {
                    Thread.sleep(500);
                } catch (InterruptedException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }


public byte[] ReadFromSocket() throws IOException {
    if (socketState == SocketState.CONNECTED) {
        byte[] buffer = new byte[1024];
        int noOfBytesRead = nis.read(buffer, 0, 1024); // This is blocking
        while (noOfBytesRead == -1) {
            noOfBytesRead = nis.read(buffer, 0, 1024); // This is blocking
            try {
                Thread.sleep(50);
            } catch (InterruptedException e) {
            }
        }
        byte[] tempdata = new byte[noOfBytesRead];
        System.arraycopy(buffer, 0, tempdata, 0, noOfBytesRead);
        return tempdata;
    } else {
        throw new IOException("Socket Not Connected");
    }
}
EN

回答 1

Stack Overflow用户

发布于 2016-08-31 03:59:40

只要TCP连接尝试从缓冲区读取,而另一端已丢弃该连接,就会显示此错误消息。通常在超时后,如果您正在发送数据,out.checkError()将返回true

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/24552226

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档