HttpWebRequest ve HttpWebResponse ile kalıcı bir bağlantı okumaya nasıl gideceğimi merak ediyorum. Sorun, GetResponseStream() işlevinin sunucu bağlantısının dönmeden önce kapatılmasını beklemesi gibi görünüyor.C# HttpWebResponse Comet problem
Kuyruklu yıldız bağlantısını okumak için kolay bir yol var mı? Çalışmıyor örnek .
// 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?
GetResponseStream() bağlantısının kapatılmasını beklediğini nereden biliyorsunuz? – feroze