IWeb_Release | developer.brewmp.com IWeb_Release | developer.brewmp.com

Developer

IWeb_Release

Forums:

Hello,

According to the IWEB API documentation: "The IWeb interface is the context in which web transactions are conducted, completed. An IWeb interface pointer is designed to be created at application startup, initialized, and used until application shutdown."

However looking at RoadWarrior Sample code, in the WebCleanup function, which is called after each data call, the IWEB_Release API is called:

static void WebCleanup(CRoadWarriorApp *pMe)
{
CALLBACK_Cancel(&pMe->m_Callback);

if (pMe->m_pIWebResp)
{
IWEBRESP_Release(pMe->m_pIWebResp);
pMe->m_pIWebResp = NULL;
}

if (pMe->m_pIWeb)
{
IWEB_Release(pMe->m_pIWeb);
pMe->m_pIWeb = NULL;
}

if (pMe->m_BodyBuffer)
{
FREE(pMe->m_BodyBuffer);
pMe->m_BodyBuffer = NULL;
}
pMe->m_BodySize = 0;
pMe->m_BodyAllocSize = 0;

StopProgressDisplay(pMe);

In my code in the WebCleanup function I only call:

if(m_Callback.pfnCancel)
{
CALLBACK_Cancel(&m_Callback);
}

if (m_pIWebResp)
{
IWEBRESP_Release(m_pIWebResp);
m_pIWebResp = NULL;
}

However, from time to time I get a fault connection with error 1289, even with strong signal.

Does anybody know what is the right way to use IWEB_Release?

After each data call or at the end just before closing the application?

Thank you.

You can use the IWEB either way you have described, if you want to reuse the IWEB interface, just make sure that you have reinitialized properly.

You can use the IWEB either way you have described, if you want to reuse the IWEB interface, just make sure that you have reinitialized properly.

Releasing IWEB at the end of data call is enough but, it is safe to release while closing the application also.

Releasing IWEB at the end of data call is enough but, it is safe to release while closing the application also.

I sometimes get an error 1289. Does anybody know what can be an explanation to this and a probable fix?
Thanks,
Diego

I sometimes get an error 1289. Does anybody know what can be an explanation to this and a probable fix?
Thanks,
Diego