I am a biomechanical engineer in need of some help with code modification.
The application I recieved from a hardware manufacturer receives UDP datagrams from their software and displays that data as legible information in a commmand window. It runs indefinitely and does not terminate at all unless the window is closed by the user.
Please see the following google drive folder for the application, as well as the corresponding source code:
I want the application to self terminate. This can be either after a set number of seconds of running, or after exactly one (1) sample has been received. Please see the example outputs jointangledata.txt and jointangledata_appended.txt. The former is what the output looks like when the program is allowed to open and run indefinitely until terminated by the user. The second is the output I want from the program per time it is opened. The data collection was performed in a MatLab environment, where the application was called using system() and then the output in the MatLab command window saved to a text file using the diary function.
Any insight or possible solutions would be greatly appreciated.
Thank you,
Kevin
Here is main.cpp:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#include "udpserver.h"
#include "streamer.h"
#include <conio.h>
#include <xsens/xstime.h>
int main(int argc, char *argv[])
{
std::string hostDestinationAddress = "localhost";
int port = 9763;
UdpServer udpServer(hostDestinationAddress, (uint16_t)port);
while (!_kbhit())
XsTime::msleep(10);
return 0;
}