#include <dwc.h>
int DWC_GetGHTTPDataEx(
const char* url,
int bufferlen,
BOOL buffer_clear,
DWCGHTTPProgressCallback progressCallback,
DWCGHTTPCompletedCallback completedCallback,
void* param );
Downloads data from the URL specified with url.
Memory is the size specified by bufferlen
and is allocated inside the DWC library. Specifying 0 allocates 2048 bytes of memory first, and then allocates additional 2048 bytes chunks as needed based on the reception data size, which enables data reception up to the application-allocated heap region limit.
If the DWC_ProcessGHTTP function is called continuously after calling this function, the download process proceeds, and once the download process is complete, a completion callback is called.
When buffer_clear
is set to TRUE, the reception buffer is deallocated immediately after exiting the completion callback, so be sure to copy the reception data before using it. When buffer_clear
is set to FALSE, the GHTTP library does not deallocate the reception buffer, so when it is convenient, be sure to use the application to deallocate the pointer to the reception buffer that is passed as the argument of the completion callback. Use the DWC_Free function to deallocate the reception buffer.
To find the communication status when downloading, call the DWC_GetGHTTPState function using the request identifier of the return value.
url |
URL of download destination |
bufferlen |
Size of the reception buffer |
buffer_clear |
Indicates whether to deallocate the reception buffer after data is received. (TRUE: Deallocate, FALSE: Do not deallocated) |
progressCallback |
The pointer to the callback function called during communication. |
completedCallback |
The pointer to the callback function called when the download is complete. |
param |
Callback parameter |
0 or higher |
Request identifier |
DWC_GHTTP_IN_ERROR |
An error is being generated |
DWC_GHTTP_FAILED_TO_OPEN_FILE |
File open failed |
DWC_GHTTP_INVALID_POST |
Invalid transmission |
DWC_GHTTP_INSUFFICIENT_MEMORY |
Insufficient memory |
DWC_GHTTP_INVALID_FILE_NAME |
Invalid file name |
DWC_GHTTP_INVALID_BUFFER_SIZE |
Invalid buffer size |
DWC_GHTTP_INVALID_URL |
Invalid URL |
DWC_GHTTP_UNSPECIFIED_ERROR |
Unspecified error |
DWC_GetGHTTPData, DWC_GetGHTTPState, DWC_ProcessGHTTP, DWCGHTTPProgressCallback DWCGHTTPCompletedCallback
01/18/2006 Added DWC_GHTTP_IN_ERROR
to the return values.
10/27/2005 Initial version.