DWC_GetGHTTPDataEx2

Syntax

#include <dwc.h>

int DWC_GetGHTTPDataEx2(
            const char* url,
            int bufferlen,
            BOOL buffer_clear,
            DWCGHTTPPost *post,
            DWCGHTTPProgressCallback progressCallback,
            DWCGHTTPCompletedCallback completedCallback,
            void* param );

Description

Uploads/Downloads data from the URL specified in url.

To upload the data, specify, in post, a DWCGHTTPPost type of object created by the DWC_GHTTPNewPost function.

Inside the library allocate memory of the size specified by bufferlen. Specifying 0 allocates 2048 bytes of memory first, then allocates additional 2048 bytes chunks as needed based on the reception data size. This enables data reception up to the application-allocated heap region limit.

When buffer_clear is set to TRUE, the reception buffer is deallocated immediately after exiting the completion callback. 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. Be sure to have the application 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.

If the DWC_ProcessGHTTP function is called repeatedly after calling this function, the communication process will proceed and the completion callback will be called when the process completes. To find the communication status during processing, call the DWC_GetGHTTPState function using the request identifier of the return value..

Arguments

url The URL from which to download. NULL-terminated string.
bufferlen Size of the reception buffer.
buffer_clear Indicates whether to deallocate the reception buffer after data is received.
(TRUE: deallocate; FALSE: do not deallocate.)
post Pointer to the DWCGHTTPPost type object to be uploaded.
progressCallback The pointer to the callback function called during communication.
completedCallback Pointer to the callback function called when the download is complete.
param Callback parameter.

Return Values

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.

See Also

DWC_GHTTPNewPost
DWC_ProcessGHTTP
DWCGHTTPProgressCallback
DWCGHTTPCompletedCallback
DWC_Free
DWC_GetGHTTPState

Revision History

2007/10/15 To the description of the url argument, added an explanation of the NULL terminator.
2006/12/27 Initial version.


CONFIDENTIAL