Skip to content
Snippets Groups Projects
Commit 6a9c79a6 authored by Casey Goodlett's avatar Casey Goodlett
Browse files

Enable packet file sender to operator in a loop

For testing purposes its nice to have a sensor stream that runs arbitrarily
long
parent e8480c50
No related branches found
No related tags found
No related merge requests found
......@@ -41,29 +41,38 @@
int main(int argc, char* argv[])
{
if (argc != 2) {
std::cout << "Usage: " << argv[0] << " <packet file>" << std::endl;
if (argc < 2) {
std::cout << "Usage: " << argv[0] << " <packet file> [loop]" << std::endl;
return 1;
}
std::string filename(argv[1]);
int loop = 0;
if(argc > 2)
{
loop = atoi(argv[2]);
}
try
{
std::string destinationIp = "127.0.0.1";
int dataPort = 2368;
vvPacketSender sender(filename, destinationIp, dataPort);
//socket.connect(destinationEndpoint);
while (!sender.done())
do
{
sender.pumpPacket();
if ((sender.packetCount() % 500) == 0)
vvPacketSender sender(filename, destinationIp, dataPort);
//socket.connect(destinationEndpoint);
while (!sender.done())
{
printf("total sent packets: %lu\n", sender.packetCount());
}
sender.pumpPacket();
if ((sender.packetCount() % 500) == 0)
{
printf("total sent packets: %lu\n", sender.packetCount());
}
boost::this_thread::sleep(boost::posix_time::microseconds(200));
}
boost::this_thread::sleep(boost::posix_time::microseconds(200));
}
} while(loop);
}
catch( std::exception & e )
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment