I call it like this:Code: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 fixed it i just needed to get rid of doevents.Code:client.GetStream().BeginRead(readBuffer, 0, READ_BUFFER_SIZE, new AsyncCallback(DoRead), null); while (Finished != true) { Application.DoEvents(); } Finished = false;




Reply With Quote