Hi guys!
I have Q2686 modem with WIP 2.00.15 software and 4.11.00 OS and C61b firmware. I am trying to download a txt file from an internet address using http protocol but I am having problems. It appears to me WIP_CEV_ERROR -993 which means DNS FAILURE and I cannot figure out what can go wrong. I have built my code according to WIP_OPEN_AT_IP_CONNECTIVITY_DEVELOPMENT_GUIDE.pdf file and also read some other posts about DNS problems. Could somebody,please, check the code and tell me what can go wrong?
Maybe it is necessary to ask a register key from my distributor? But I do connect using GPRS.
Is it also possible that WIP of this version has problems with DNS and if so, how what version should I have so that my module works properly?
The traces I get are the followings:
Trace IP 1 [GPRS]: initialized.
Trace IP 1 [GSM]: initialized.
Trace IP 1 [UART1]: initialized.
Trace IP 1 [UART2]: initialized.
Trace IP 1 [GPRS]: open: -> DISCONNECTED
Trace IP 1 [GPRS]: start: -> CONNECTING
Trace IP 1 Connection started,an event will be sent after completion
Trace IP 1 [GPRS]: GPRS EVENT SETUP OK (cid=1): GPRS activate
Trace IP 1 [GPRS]: GPRS EVENT: 27 (cid=1)
Trace RLU 1 Unable to find the string of the remote trace in the file (ID = 874240)
Trace IP 1 [GPRS]: GPRS EVENT ACTIVATE OK (cid=5): FCM open
Trace IP 1 [GPRS]: FCM subscribe: 0
Trace IP 1 [GPRS]: FCM EVENT FLOW OPENNED: -> CONNECTED
Trace IP 1 IP connectivity
Trace IP 1 Downloading the file
Trace IP 1 [HTTP] new request maps.google.com/maps/geo?q=37.94 … utput=JSON @ 00476e20
Trace IP 1 [HTTP] connect to host: maps.google.com:80
Trace IP 1 [HTTP] channel = 00476bc0
Trace IP 1 [WIPEV] WIP_CEV_ERROR @ 0x476bc0 (errno = -993)
Trace IP 1 [HTTP] error -993 @ 00476e20
Trace IP 1 [HTTP] channel closed by server
Trace IP 1 [WIPEV] WIP_CEV_ERROR @ 0x476e20 (errno = -993)
Trace RLU 1 Unable to find the string of the remote trace in the file (ID = 874240)
Trace IP 1 [UART2]: exit.
Trace IP 1 [UART1]: exit.
Trace IP 1 [GSM]: exit.
Trace IP 1 [GPRS]: exit.
Please, someone that has managed to download a file using http protocol help me!
My code is the following:(I call ActivateGPRS())
void Activate_Gprs()
{
s8 temp;
wip_netInit();
/*Open bearer and install event handler*/
if(wip_bearerOpen (&MyBearer, "GPRS", myHandler, NULL) !=0){
/*Cannot open bearer*/
//#ifdef TRACEON
TRACE((TraceLevel, "Cannot open bearer"));
//#endif
return FALSE;
}
/*configure GPRS interface */
if (wip_bearerSetOpts (MyBearer, WIP_BOPT_GPRS_APN, "gwap.b-online.gr", WIP_BOPT_LOGIN, "wap", WIP_BOPT_PASSWORD,"wap", WIP_BOPT_END)!=0){
/*cannot configure bearer*/
//#ifdef TRACEON
TRACE((TraceLevel, "cannot configure bearer"));
//#endif
wip_bearerClose(MyBearer);
return FALSE;
}
/*start connection*/
temp = wip_bearerStart(MyBearer);
if (temp!=0){
/*cannot start bearer*/
//#ifdef TRACEON
//TRACE((TraceLevel, "cannot start bearer"));
//#endif
switch ( temp )
{
case WIP_BERR_OK_INPROGRESS :
TRACE (( TraceLevel, "Connection started,an event will be sent after completion"));
break;
case WIP_BERR_BAD_HDL :
TRACE (( TraceLevel, "Invalid handler"));
break;
case WIP_BERR_BAD_STATE:
TRACE (( TraceLevel, "The bearer is not stopped"));
break;
case WIP_BERR_DEV :
TRACE (( TraceLevel, "Error from link layer initialization"));
break;
default :
TRACE (( TraceLevel, "Nothing from above!" ));
break;
}
//wip_bearerClose (MyBearer);
return FALSE;
}
else
{
//#ifdef TRACEON
TRACE((TraceLevel, "Ok the bearer has started"));
//#endif
}
/*connection status will be reported to the event handler*/
return TRUE;
//URLDownloadToFile(0,"http://www.vb-helper.com/vbhelper_425_64.gif","C:\vbhelper_425_64.gif",0,0);
}
void http_event (wip_event_t *ev, void *ctx)
{
wip_channel_t ch;
s32 ret;
char * buf;
/* get originating channel*/ ch=ev->channel;
switch (ev->kind){
case WIP_CEV_OPEN:
/*get status code*/
wip_getOpts(ch, WIP_COPT_HTTP_STATUS_CODE, &ret,WIP_COPT_END);
if (ret!=200){
/*not OK...*/
}
break;
case WIP_CEV_READ:
/*read html page */
while (ret=wip_read (ch, buf, sizeof(buf))>0){
TRACE((TraceLevel, "%s",buf));
}
break;
case WIP_CEV_PEER_CLOSE:
/*html page has been received*/
wip_close (ch);
break;
case WIP_CEV_ERROR:
/*socket error...close channel*/
delaysec();
wip_bearerClose( MyBearer );
wip_netExit();
//wip_close(ch);
break;
}
}
//////////////////////////////////////////////////////////////////////
/*Application*/
void Myfunction ()
{
/*Setup HTTP session*/
http=wip_HTTPClientCreateOpts(NULL,NULL,WIP_COPT_HTTP_HEADER,"User-Agent","WIP-HTTP-Client/1.0",WIP_COPT_END);
/*Get the file*/
//#ifdef TRACEON
TRACE((TraceLevel, "Downloading the file"));
//#endif
wip_getFileOpts(http, "http://maps.google.com/maps/geo?q=37.949713779200465,23.63210678100586&output=JSON", http_event, NULL, WIP_COPT_HTTP_HEADER, "Accept", "text/javascript", WIP_COPT_END);
//wip_getFileOpts(http, "http://www.vb-helper.com/vbhelper_425_64.gif", http_event, NULL, WIP_COPT_HTTP_HEADER, "Accept", "image/gif", WIP_COPT_END);
}
//////////////////////////////////////////////////////////////////////
/*bearer eventshandler */
void myHandler (wip_bearer_t br, s8 event, void *context)
{
switch (event){
case WIP_BEV_IP_CONNECTED:
TRACE((TraceLevel, "IP connectivity"));/*IP connectivity start IP application from here*/
Myfunction ();
break;
case WIP_BEV_IP_DISCONNECTED:
TRACE((TraceLevel, "IP disconnected"));
/*stop IP application*/
break;
/*other events:*/
default:
/* start bearer: report error to higher levels*/
break;
}
}
Thanks very much!