My pseudo code is this…
the GetData_1() sends a request to serial Port, after receiving the Reply, another request is send by GetData_2(). After receiving the response of second request all the received data is together inserted into the database. And then the GetData_1() is called again to continue this process recursively…
But……..
Am getting an error of stack over flow…
please help…
GetDat_1()
{
//Send a request To SerialPort
//wait a 500 ms.
// read The response and insert it into an array...
GetData_2();
}
GetData_2()
{
// Send a request to SerialPort
// Wait a 500 ms.
// Read The response and insert it into another array
InsertAllData();
GetData_1();
}
InsertAllData()
{
// insert all data into the database
}
It’s because the repeated calls never return and the call stack just keeps on growing resulting in a StackOverFlowException sooner or later, most likely sooner.
Instead, unroll into an iterative way of coding.