Game Development Reference
In-Depth Information
get { return dynamicBuffer; }
set { dynamicBuffer = value; }
public int DataLength
get { return dataLength; }
set { dataLength = value; }
public int BytesRead
get { return bytesRead; }
set { bytesRead = value; }
public AsyncFileDownloadState()
processBuffer = new byte[bufferSize];
The Core System
The solution presented in this chapter encapsulates a lot of the implementation
details of HttpWebRequest and asynchronous communication into a wrapper class.
There are a number of ways to implement an asynchronous model; some are
extremely simple, while some are complex and robust. The solution for this chap-
ter sits somewhere between those extremes.
The following code describes the core system that handles asynchronous web
requests and responses.
public delegate void AsyncDownloadCompleteHandler(byte[] data);
public delegate void AsyncDownloadProgressHandler(int bytesRead,
int dataLength);
internal class AsyncFileDownloadSystem
Search Nedrilad ::

Custom Search