【发布时间】:2014-10-22 08:41:20
【问题描述】:
我正在尝试使用流读取器来捕获通过 TCPClient 发送的字符串,但是它不会不断地汇集,它只会通过循环之一。
private void recMessage()
{
while (true)
{
String listAsString = "";
try
{
listAsString = streamReader.ReadLine();
}
catch (Exception e)
{
Interaction.MsgBox("Lost connection with server./n/n" + e);
break;
}
newSprite(listAsString);
}
}
}
它似乎停在 listAsString = streamReader.ReadLine();
有什么想法吗?
谢谢
詹姆斯
【问题讨论】:
标签: loops while-loop tcpclient streamreader steam