Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

Forums:

Hi All
I am uploading an image file to a local server (IIS) by using IWeb interface.My problem is that somtimes the image is loaded successfully or sometime not.I can't determine the actual cause for that.Here I am posting my code and the output log.
is there is any issue related to the server up and down. My brew codes following:
void upload_UploadImage(upload *pMe)
{

IFile *pIFile=NULL;
IFileMgr *pIFileMgr;
FileInfo fileinfo;
ISource *pISource=NULL;
int i=0;

ISHELL_CreateInstance(pMe->a.m_pIShell,AEECLSID_FILEMGR,(void**)&pIFileMgr);
pIFile=IFILEMGR_OpenFile(pIFileMgr,"icon_contacts.png",_OFM_READ);
IFILE_GetInfo(pIFile,&fileinfo);

ISOURCEUTIL_SourceFromAStream(pMe->pISourceUtil,(IAStream*)pIFile,&pISource);
CALLBACK_Init(&pMe->CallBack,upload_WebReadCB,pMe);
pMe->aw[i].nId=WEBOPT_HANDLERDATA;
pMe->aw[i].pVal=(void*)pMe;
i++;
pMe->aw[i].nId=WEBOPT_METHOD;
pMe->aw[i].pVal=(void*)"POST";
i++;
pMe->aw[i].nId=WEBOPT_BODY;
pMe->aw[i].pVal=pISource;
i++;
pMe->aw[i].nId=WEBOPT_END;

IWEB_AddOpt(pMe->pIWeb,pMe->aw);
IWEB_GetResponse(pMe->pIWeb,(pMe->pIWeb,&pMe->pIWebResp,&pMe->CallBack,URL,

WEBOPT_CONTENTLENGTH,fileinfo.dwSize,
WEBOPT_STATUSHANDLER,WebStatusDisplay,
WEBOPT_CONNECTTIMEOUT,-1,
WEBOPT_FLAGS,WEBREQUEST_FORCENEWCONN,
WEBOPT_END));
DBGPRINTF("request sended to the server:::::::::::");

}
void upload_WebReadCB(upload *pMe)
{
AECHAR *msg;

WebRespInfo *pWebRespInfo=IWEBRESP_GetInfo(pMe->pIWebResp);
msg=(AECHAR*)MALLOC(STRLEN("Image uploaded")*3);
STRTOWSTR("Image Uploaded",msg,(STRLEN("Image uploaded")*2));
if(WEB_ERROR_SUCCEEDED(pWebRespInfo->nCode)==TRUE)
{
DBGPRINTF("success.................");
IDISPLAY_DrawText(pMe->a.m_pIDisplay,AEE_FONT_NORMAL,msg,-1,30,60,NULL,IDF_ALIGN_CENTER);
WEB_ERROR_MAP(pWebRespInfo->nCode);
IDISPLAY_Update(pMe->a.m_pIDisplay);
}
else
{

STRTOWSTR("Server Error",msg,(STRLEN("Server Error")*2+5));
IDISPLAY_DrawText(pMe->a.m_pIDisplay,AEE_FONT_NORMAL,msg,-1,30,60,NULL,IDF_ALIGN_CENTER);
IDISPLAY_Update(pMe->a.m_pIDisplay);
}

void WebStatusDisplay( void* pNotifyData, WebStatus ws, void* p)
{
upload* pMe = (upload*)pNotifyData;
char * nRes = NULL;
AECHAR *msg=(AECHAR*)MALLOC(50);

switch (ws)
{
case WEBS_STARTING:
nRes = "Starting";

break;
case WEBS_PROGRESS:
nRes = "Progressing";

break;
case WEBS_CANCELLED:
nRes = "Cancelled";

break;
case WEBS_GETHOSTBYNAME:
nRes = "Get host";
break;
case WEBS_CONNECT:
nRes="Connect";
break;
case WEBS_SENDREQUEST:
nRes = "Send request";
break;
case WEBS_READRESPONSE:
nRes = "read response";
break;
case WEBS_GOTREDIRECT:
nRes = "Go redirect";
break;
case WEBS_CACHEHIT:
nRes = "....................CacheHit";
break;
}
DBGPRINTF("%s",nRes);
STRTOWSTR(nRes,msg,50);
IDISPLAY_DrawText(pMe->a.m_pIDisplay,AEE_FONT_NORMAL,msg,-1,30,45,NULL,IDF_ALIGN_CENTER);
IDISPLAY_Update(pMe->a.m_pIDisplay);

and the brew output log when the image uploaded successfully

*OEMDebug.c:183 - DBGEvent=0x2 cls=0x1008000 pl=0x0
'BREW_Simulator.exe': Loaded 'C:\Program Files\Qualcomm\BREWUIWidgets_2.0.1\examples\upload\upload.dll', Symbols loaded.
*AEEShell.c:6919 - #*g*C=106280d:3
*AEEShell.c:6919 - #*g*C=101402c:3
*AEEShell.c:6919 - #*g*C=101402d:3
*AEEShell.c:6919 - #*g*C=101402e:3
*AEEShell.c:7215 - #*gST=305550403
*upload.c:259 - ....................Starting
*sim_dssocket2.:3063 - dss_open_netlib2
*sim_dssocket2.:3093 - allocated new app_id=0
*upload.c:259 - ..........................Get host
*upload.c:200 - request sended to the server:::::::::::
*OEMDebug.c:183 - DBGEvent=0x0 cls=0x12365443 pl=0x0
*sim_dssocket2.:3656 - dss_pppopen: app_id=0
*sim_dssocket2.:849 - Bind pif 6693736 with app_id 0
*sim_dssocket2.:798 - index 0 app_id=0
*sim_dssocket2.:2036 - DSIFace_BringUpIFace pif=6693736, state=DOWN
*sim_dssocket2.:1916 - DSIFace_BringUpPhysLink pif=6693736, state=DOWN
*sim_dssocket2.:1348 - DSIFace_SendEvent pif=6693736, event=DS_IFACE_EVENT_PHYS_LINK_COMING_UP
*OEM.c:168 - OEMNotify: Call Dialogs (FALSE)
*AEENet.c:665 - #*gDC
*AEEShell.c:3672 - #*p:ECode:102, Key:e035
*AEEShell.c:3672 - #*p:ECode:102, Key:e035
*AEEShell.c:6919 - #*g*C=106280d:3
*AEEShell.c:6919 - #*g*C=101402c:3
*AEEShell.c:6919 - #*g*C=101402d:3
*AEEShell.c:6919 - #*g*C=101402e:3
*sim_dssocket2.:1799 - DSIFace_PhysLinkUp pif=6693736
*sim_dssocket2.:1348 - DSIFace_SendEvent pif=6693736, event=PHYS_LINK_UP
*sim_dssocket2.:1525 - sending event to app_id 0
*sim_dssocket2.:1978 - DSIFace_IFaceUp pif=6693736
*sim_dssocket2.:1348 - DSIFace_SendEvent pif=6693736, event=UP
*sim_dssocket2.:1323 - DSIFace_Notify: pif=6693736
*sim_dssocket2.:1331 - notify app_id 0
'BREW_Simulator.exe': Loaded 'C:\WINDOWS\system32\mswsock.dll', No symbols loaded.
'BREW_Simulator.exe': Loaded 'C:\WINDOWS\system32\hnetcfg.dll', No symbols loaded.
'BREW_Simulator.exe': Loaded 'C:\WINDOWS\system32\wshtcpip.dll', No symbols loaded.
*sim_dssocket2.:1916 - DSIFace_BringUpPhysLink pif=6693736, state=UP
*sim_dssocket2.:1916 - DSIFace_BringUpPhysLink pif=6693736, state=UP
*sim_dssocket2.:1916 - DSIFace_BringUpPhysLink pif=6693736, state=UP
*sim_dssocket2.:1916 - DSIFace_BringUpPhysLink pif=6693736, state=UP
*upload.c:259 - .................................Connect
*sim_dssocket2.:3063 - dss_open_netlib2
*sim_dssocket2.:3093 - allocated new app_id=1
*sim_dssocket2.:3656 - dss_pppopen: app_id=1
*sim_dssocket2.:849 - Bind pif 6693736 with app_id 1
*sim_dssocket2.:798 - index 0 app_id=0
*sim_dssocket2.:798 - index 1 app_id=1
*sim_dssocket2.:2036 - DSIFace_BringUpIFace pif=6693736, state=UP
*OEM.c:168 - OEMNotify: Call Dialogs (FALSE)
*sim_dssocket2.:1916 - DSIFace_BringUpPhysLink pif=6527592, state=UP
*sim_dssocket2.:1916 - DSIFace_BringUpPhysLink pif=6527592, state=UP
*sim_dssocket2.:2764 - ERROR: 0 "ps->nConnState == CS_CONNECTED" fulfilled!
*upload.c:259 - ..........................Send request
*sim_dssocket2.:1916 - DSIFace_BringUpPhysLink pif=6527592, state=UP
*sim_dssocket2.:1916 - DSIFace_BringUpPhysLink pif=6527592, state=UP
*sim_dssocket2.:1916 - DSIFace_BringUpPhysLink pif=6527592, state=UP
*upload.c:259 - ...........................read response
*sim_dssocket2.:1916 - DSIFace_BringUpPhysLink pif=6527592, state=UP
*sim_dssocket2.:4121 - ERROR: 102 "ps->bRecvWait" fulfilled!
*sim_dssocket2.:1916 - DSIFace_BringUpPhysLink pif=6527592, state=UP
*sim_dssocket2.:1916 - DSIFace_BringUpPhysLink pif=6527592, state=UP
*upload.c:218 - success.................
*sim_dssocket2.:1916 - DSIFace_BringUpPhysLink pif=6527592, state=UP
*sim_dssocket2.:1348 - DSIFace_SendEvent pif=6693736, event=QOS_UNAWARE_SYSTEM

and when the image file is not uploaded the brew output logs is:

loaded.
*AEEShell.c:6919 - #*g*C=106280d:3
*AEEShell.c:6919 - #*g*C=101402c:3
*AEEShell.c:6919 - #*g*C=101402d:3
*AEEShell.c:6919 - #*g*C=101402e:3
*AEEShell.c:7215 - #*gST=305550403
*upload.c:267 - ..................Starting
*sim_dssocket2.:3063 - dss_open_netlib2
'BREW_Simulator.exe': Loaded 'C:\WINDOWS\system32\mswsock.dll', No symbols loaded.
'BREW_Simulator.exe': Loaded 'C:\WINDOWS\system32\dnsapi.dll', No symbols loaded.
'BREW_Simulator.exe': Loaded 'C:\WINDOWS\system32\winrnr.dll', No symbols loaded.
'BREW_Simulator.exe': Loaded 'C:\WINDOWS\system32\wldap32.dll', No symbols loaded.
'BREW_Simulator.exe': Loaded 'C:\WINDOWS\system32\rasadhlp.dll', No symbols loaded.
*sim_dssocket2.:3093 - allocated new app_id=0
*upload.c:267 - ....................Get host
*upload.c:200 - request sended to the server:::::::::::
*OEMDebug.c:183 - DBGEvent=0x0 cls=0x12365443 pl=0x0
*AEEShell.c:3672 - #*p:ECode:102, Key:e035
*sim_dssocket2.:3656 - dss_pppopen: app_id=0

////and the rest web status messages are not displayed

is there any issue related to the server up and down?

also what should I have to do if I wanted to upload multiple images in one request in the same server.

waiting for your replies........