ポート 2628 で dict.org サーバーに接続しようとしていますが、サーバーから完全な応答を取得できません。コードは次のようになります。
TcpClient client = new TcpClient("216.18.20.172", 2628);
try
{
Stream s = client.GetStream();
StreamReader sr = new StreamReader(s);
StreamWriter sw = new StreamWriter(s);
sw.AutoFlush = true;
Console.WriteLine(sr.ReadLine());
while (true)
{
Console.Write("Word: ");
string msg = Console.ReadLine();
sw.WriteLine("D wn {0}", msg);
if (msg == "") break;
Console.WriteLine(sr.ReadLine());
}
s.Close();
}
finally
{
client.Close();
Console.ReadLine();
}
単語に「こんにちは」と入力すると、1行の応答が返されます。何かを入力してEnterキーを押すと、次の行が表示されます。完全な応答を一度に表示する方法は?