HttpWebRequest および HttpWebResponse との永続的な接続をどのように読み取るのか疑問に思っています。問題は、GetResponseStream() 関数がサーバー接続が閉じられるのを待ってから戻ることにあるようです。
彗星のつながりを読み取る別の簡単な方法はありますか? 動かない例。
// get the response stream
Stream resStream = response.GetResponseStream();
string tempString = null;
int count = 0;
do
{
// fill our buffer
count = resStream.Read(buf, 0, buf.Length);
// as long as we read something we want to print it
if (count != 0)
{
tempString = Encoding.ASCII.GetString(buf, 0, count);
Debug.Write(tempString);
}
}
while (true); // any more data to read?