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

Developer

Forums

Forums:

Hello All
I am trying to connect to Google using the code snippet given below. I am getting WEB_ERROR_CONNECT ///* some kind of connect error */ in pWebRespInfo->nCode in the callback function WebReadCB( ) . Can any one tell me what’s wrong in this code?

************************************************************************************
#define SERVER_URL "www.google.com"

STRCPY(pme->m_szUrl, SERVER_URL);

CALLBACK_Init(&pme->m_Callback, WebReadCB, pme);

IWEB_GetResponse(pme->m_pIWeb, (pme->m_pIWeb, &pme->m_pIWebResp, &pme->m_Callback,pme->m_szUrl,
WEBOPT_HANDLERDATA, pme,
WEBOPT_HEADER, "X-Method: GET\r\n",
WEBOPT_METHOD,"GET",
WEBOPT_PROXYSPEC, "http:///http://198.164.1.254:3128/",
WEBOPT_STATUSHANDLER, WebStatusNotification,
WEBOPT_END));

hi,
Check the syntax "http:///http://198.164.1.254:3128/"
Why you put the / at the end ?

hi,
Check the syntax "http:///http://198.164.1.254:3128/"
Why you put the / at the end ?

You should also not hardcode the strings. This will store the variables on the stack. You should store these variables on the heap. You may not see an issue in simple apps, but a more active app will corrupt this data since the call is asynchronous.

You should also not hardcode the strings. This will store the variables on the stack. You should store these variables on the heap. You may not see an issue in simple apps, but a more active app will corrupt this data since the call is asynchronous.

I have updated my code as per the reply but still iam getting the same error. WEB_ERROR_CONNECT ///* some kind of connect error */.
IWEB_GetResponse(pme->m_pIWeb, (pme->m_pIWeb, &pme->m_pIWebResp, &pme->m_Callback,pme->m_szUrl,
WEBOPT_HANDLERDATA, pme,
WEBOPT_HEADER, "X-Method: GET\r\n",
WEBOPT_METHOD,"GET",
WEBOPT_PROXYSPEC, pme->szProxy,
WEBOPT_STATUSHANDLER, WebStatusNotification,
WEBOPT_END));

I have updated my code as per the reply but still iam getting the same error. WEB_ERROR_CONNECT ///* some kind of connect error */.
IWEB_GetResponse(pme->m_pIWeb, (pme->m_pIWeb, &pme->m_pIWebResp, &pme->m_Callback,pme->m_szUrl,
WEBOPT_HANDLERDATA, pme,
WEBOPT_HEADER, "X-Method: GET\r\n",
WEBOPT_METHOD,"GET",
WEBOPT_PROXYSPEC, pme->szProxy,
WEBOPT_STATUSHANDLER, WebStatusNotification,
WEBOPT_END));

Try removing the two get headers. This is done by default. Also, make sure your proxy info is correct.

Try removing the two get headers. This is done by default. Also, make sure your proxy info is correct.

Thanks Jonathan.
The main problem was with the proxy address. But still i have to specify the ip of the host i want to connect. For eg. With google.com the application gets "WEB_ERROR_UNSUPSCHEME" /* unsupported scheme, no handler found */ error but when i replaced the url with the its ip ("http://64.233.189.104") the application gets the response.
Can any one put some more light on this. The code snippet is given bellow.
//#define SERVER_URL "http://64.233.189.104"
#define SERVER_URL "www.google.com"
STRCPY(pme->szProxy, "http:///http://x.x.x.x:x");
IWEB_GetResponse(pme->m_pIWeb, (pme->m_pIWeb, &pme->m_pIWebResp, &pme->m_Callback,pme->m_szUrl,
WEBOPT_HANDLERDATA, pme,
WEBOPT_HEADER, "X-Method: GET\r\n",
WEBOPT_PROXYSPEC, pme->szProxy,
WEBOPT_STATUSHANDLER, WebStatusNotification,
WEBOPT_END));
Gopal

Thanks Jonathan.
The main problem was with the proxy address. But still i have to specify the ip of the host i want to connect. For eg. With google.com the application gets "WEB_ERROR_UNSUPSCHEME" /* unsupported scheme, no handler found */ error but when i replaced the url with the its ip ("http://64.233.189.104") the application gets the response.
Can any one put some more light on this. The code snippet is given bellow.
//#define SERVER_URL "http://64.233.189.104"
#define SERVER_URL "www.google.com"
STRCPY(pme->szProxy, "http:///http://x.x.x.x:x");
IWEB_GetResponse(pme->m_pIWeb, (pme->m_pIWeb, &pme->m_pIWebResp, &pme->m_Callback,pme->m_szUrl,
WEBOPT_HANDLERDATA, pme,
WEBOPT_HEADER, "X-Method: GET\r\n",
WEBOPT_PROXYSPEC, pme->szProxy,
WEBOPT_STATUSHANDLER, WebStatusNotification,
WEBOPT_END));
Gopal

Is your network setup is such that it goes thru some kind of DNS ?? Looks like the network setup cannot resolve the domain google.com but can only work with the IP addresses....
check with your Network administtrator to make sure that you can use the DNS entry instead of IP address

Is your network setup is such that it goes thru some kind of DNS ?? Looks like the network setup cannot resolve the domain google.com but can only work with the IP addresses....
check with your Network administtrator to make sure that you can use the DNS entry instead of IP address

gopal.vm wrote:Thanks Jonathan.
The main problem was with the proxy address. But still i have to specify the ip of the host i want to connect. For eg. With google.com the application gets "WEB_ERROR_UNSUPSCHEME" /* unsupported scheme, no handler found */ error but when i replaced the url with the its ip ("http://64.233.189.104") the application gets the response.
Can any one put some more light on this. The code snippet is given bellow.
//#define SERVER_URL "http://64.233.189.104"
#define SERVER_URL "www.google.com"
STRCPY(pme->szProxy, "http:///http://x.x.x.x:x");
IWEB_GetResponse(pme->m_pIWeb, (pme->m_pIWeb, &pme->m_pIWebResp, &pme->m_Callback,pme->m_szUrl,
WEBOPT_HANDLERDATA, pme,
WEBOPT_HEADER, "X-Method: GET\r\n",
WEBOPT_PROXYSPEC, pme->szProxy,
WEBOPT_STATUSHANDLER, WebStatusNotification,
WEBOPT_END));
Gopal
Ah, thats because you need to add http:// to the front of the string:
http://www.google.com
http:// is the registered mime type

gopal.vm wrote:Thanks Jonathan.
The main problem was with the proxy address. But still i have to specify the ip of the host i want to connect. For eg. With google.com the application gets "WEB_ERROR_UNSUPSCHEME" /* unsupported scheme, no handler found */ error but when i replaced the url with the its ip ("http://64.233.189.104") the application gets the response.
Can any one put some more light on this. The code snippet is given bellow.
//#define SERVER_URL "http://64.233.189.104"
#define SERVER_URL "www.google.com"
STRCPY(pme->szProxy, "http:///http://x.x.x.x:x");
IWEB_GetResponse(pme->m_pIWeb, (pme->m_pIWeb, &pme->m_pIWebResp, &pme->m_Callback,pme->m_szUrl,
WEBOPT_HANDLERDATA, pme,
WEBOPT_HEADER, "X-Method: GET\r\n",
WEBOPT_PROXYSPEC, pme->szProxy,
WEBOPT_STATUSHANDLER, WebStatusNotification,
WEBOPT_END));
Gopal
Ah, thats because you need to add http:// to the front of the string:
http://www.google.com
http:// is the registered mime type

Hi Jonathan
I didn't get u, can u elaborate a bit. Buy the way if i put google.com in BREW Browser v2.0.0 it works.
Gopal

Hi Jonathan
I didn't get u, can u elaborate a bit. Buy the way if i put google.com in BREW Browser v2.0.0 it works.
Gopal