为什么没有得到执行while循环之后的语句? [英] Why statements after while loop is not getting executed?

查看:229
本文介绍了为什么没有得到执行while循环之后的语句?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于我来说没有什么问题得到while循环后执行?什么是与这个问题? (while循环永远不会被执行结束后的行)

 客户端的ServerSocket.accept =();
在的BufferedReader =新的BufferedReader(
                            新的InputStreamReader(client.getInputStream())
);而((行= in.readLine())!= NULL){
    Log.i(线,线);
    line111 + =行;
    Log.i(line111,line111);
}//不执行低于此的任何code
Log.i(山,山);


解决方案

您while循环卡住等待插座下一行上。流的来源需要关闭其端的连接。

The problem for me nothing gets executed after while loop? what's the issue with that? (The lines after the end of while loop never gets executed)

client = serverSocket.accept();
BufferedReader in = new BufferedReader(
                            new InputStreamReader(client.getInputStream())
);

while ((line = in.readLine()) != null) {
    Log.i("line",line);
    line111 +=line;
    Log.i("line111",line111);
}

//Any code below this is not executed
Log.i("shan","Shan");

解决方案

Your while loop is stuck waiting on the socket for the next line. The source of the stream needs to close the connection at its end.

这篇关于为什么没有得到执行while循环之后的语句?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆