Dear All,

Now XDK can connect to wifi and able to get the IP address of w.posttestserver.com.

 INFO | XDK3:  Connected to WPA network successfully 
 INFO | XDK3:   Ip address of the device 192.168.43.77 
 INFO | XDK3:   IP address of www.posttestserver.com is 107.170.47.130

But after that no more prints, I thought it'll print:

GET Response Content ... length

Any advice? 

Also by the way, how to check the client request from http://posttestserver.com/data/ is from this XDK device? Or customize the client request so that the XDK requst to www.posttestserver.com will be easily indentified from  http://posttestserver.com/data/?

Thanks a lot for any advice.

Ms. Zhu 

0 (0 Votes)
RE: No info from server displayed for HttpExampleClient
Answer
5/17/17 10:31 AM as a reply to Bochun Zhu.

Hello Bochun,

this is the nature of the printf implementation of the XDK. printf is not threadsafe and won't appear in the first 10 milliseconds of the systemstart in the console of the XDK Workbench. This happens because the USB connection is re-established within the systemstart and prints are sent out without checking if an USB connection is established.

If you wish to see them, then I recommend to add a delay before the desired printfs with the function vTaskDelay(). One second or two should solve the issue. Please note that the function vTaskDelay() requires as parameter a delay time in milliseconds. For example, you will need to pass in 1000 to ensure a delay of 1 second.

In addition the HttpExampleClient example needs some modification to work without issues, because the main page .html file of www.posttestserver.com has grown to large to be downloaded by the XDK.
This results in the XDK receiving the error code RC_HTTP_INVALID_RESPONSE. The application stops at this point entirely.

Therefore I recommend to change the URI path in line 197 from "/" to "/data". This change will download the subdomain /data of www.posttestserver.com, which is much smaller than the initial .html file of www.posttestserver.com.

In addition, you would have to make a modification in line 157. The if-condition there checks if the received http status code is 200 and only displays the downloaded .html file if the condition is true. I recommend to comment out the lines which check for this condition or to exchange Http_StatusCode_OK with Http_StatusCode_MovedPermanently. This will ensure that the downloaded .html file can be displayed in the XDK Workbench console.

Regarding your other question about setting up an post request: www.posttestserver.com has a detailed explanation about how to check which incoming requests are yours.

Additionally I recommend to take a look at the HTTP guide, which is available in the learning section of the XDK community, to get familiar with the HTTP POST implementation of the XDK.

Please tell me if this is helpful and do not hesitate to ask if you have further questions.

Kind regards,
Franjo

0 (0 Votes)