cx323
Jul 28th, 2006, 01:57 PM
private void DoRead(IAsyncResult ar)
{
int BytesRead;
try
{
BytesRead = client.GetStream().EndRead(ar);
if ((BytesRead < 1))
{
Finished = true;
return;
}
strHTML += Encoding.ASCII.GetString(readBuffer, 0, (BytesRead - 2));
BytesRead = 0;
client.GetStream().BeginRead(readBuffer, 0, READ_BUFFER_SIZE, new System.AsyncCallback(this.DoRead), null);
}
catch (Exception)
{
// Future Handle
}
}
I call it like this:
client.GetStream().BeginRead(readBuffer, 0, READ_BUFFER_SIZE, new AsyncCallback(DoRead), null);
while (Finished != true)
{
Application.DoEvents();
}
Finished = false;
I fixed it i just needed to get rid of doevents.
{
int BytesRead;
try
{
BytesRead = client.GetStream().EndRead(ar);
if ((BytesRead < 1))
{
Finished = true;
return;
}
strHTML += Encoding.ASCII.GetString(readBuffer, 0, (BytesRead - 2));
BytesRead = 0;
client.GetStream().BeginRead(readBuffer, 0, READ_BUFFER_SIZE, new System.AsyncCallback(this.DoRead), null);
}
catch (Exception)
{
// Future Handle
}
}
I call it like this:
client.GetStream().BeginRead(readBuffer, 0, READ_BUFFER_SIZE, new AsyncCallback(DoRead), null);
while (Finished != true)
{
Application.DoEvents();
}
Finished = false;
I fixed it i just needed to get rid of doevents.