Hi, I´m sending an Array of GET string command to a web server… I don´t know how… but as soon as I send the tcpStart command the application is reseted.
I´ve been sending single strings with no problems at all.
Hi Henrique,
There are a few things for which I would like to draw your attention:
“request” is a single dimensional array whereas, the GPS_String is a two dimensional array. In the code:
wm_sprintf(request[i], GPS_String[GPS_Indice]);
I think the desired behavior will not be achieved. Probably you wanted to declare request as two dimensional array and would like to copy the GPS_String in the array.
In case, request contains large amount of data, and the application sends the data using adl_atSendResponse() API, the module might crash if it is not able to allocate the amount of memory which is needed to send the data. Hence, it is advisable to send small amount of data using adl_atSendResponse(). In case, you are sending data for debugging purposes, you can use the TRACE macro. If this is not possible, then you can implement a timer from which you can send the data to the external application using adl_atSendResponse() in small chunks.
I am not sure about this point, but if the “request” array does not contain an ending NULL (’\0’) character then wm_strlen () function might crash. So, it is advisable to clean the array at startup using wm_memset () API.
Hi Henrique,
You should clear the request array before filling the data in it. Hence, put the wm_memset() call before the "if ((GPS_Entrada - GPS_Saida)>3) " condition.
For the purpose of debugging, first try to send the data using the TRACE () macro. This would help you eliminate the case in which the applicaiton is resetting because of length limitation of adl_atSendResponse () API.
If your code works fine, the you can replace TRACE () macro calls to adl_atSendResponse () API but with smaller length sent with each call.
I don’t think they should go to the next line. That maybe happens when you use MFC classes but not with a sprintf()! Every character is treated equally and they are copied to the destination into consecutive bytes… There is no line feed processing of any kind…
I noticed that when I try to send string after string using a loop I send the first as showed and then the second… that doesn´t make sense to the server…
My suggestion is: don’t use 2-dimensional string arrays. I don’t know how to use them, and it looks like you have problems with that, too… Can you just use simple char arrays?
Hi Henrique,
Sorry for the delayed reply (I was too busy to login to Forum). The fact that you are trying to send too much data to the server in one call to ed_SendDataExt () API might also be the cause of the problem. Please verify that the return value of ed_SendDataExt () API. Also check if you are allowed to send the data you are sending using ed_SendDataExt () API (by checking for the MaxLen parameter of the tcp_pfDataRequest () function.
In order to find the cause of module reset, you should use Debug mode of execution and then step through the application (using breakpoints and other stuff provided by Microsoft Visual Studio). The statement on which your Visual Studio gives exception will be the most probable cause of the module reset.
For target mode, you should enable the RTK level 1 of traces and see if the module gives any RTK exception while crashing (or ARM exception). In case, you receive an ARM exception like 1 xxxx, it means that the application has performed some invalid memory related operation (like trying to write beyond its allocated address space, or writing to a NULL pointer). This will help me find the actual cause of the problem.
Another problem which I found in your code is that in tcp_pfDataRequest () function, you are using wm_sprintf () function without providing a format specifier.
You are using “wm_sprintf(request[i], GPS_String[GPS_Indice]);”
but actually it should be “wm_sprintf(request[i],”%s", GPS_String[GPS_Indice]);
Ideally, you should try to use wm_memcpy() or wm_strncpy() for these kind of operations.
Please modify your code and let me know.
Thanks for the replies. I really noticed these errors. They came from previous “comments”.
Here´s the solution I found:
I´m working with 1 dimensional array and putting all data after the other. I´ll let the server handle and manipulate the information that is getting there.