Allowing user to set the interface as an argument for sv_publisher_example.c

This commit is contained in:
Cedric Boudinet 2017-05-11 10:54:02 +02:00
parent 8999487b24
commit d33f16ca8a

View file

@ -20,7 +20,16 @@ void sigint_handler(int signalId)
int
main(int argc, char** argv)
{
SampledValuesPublisher svPublisher = SampledValuesPublisher_create("vboxnet0");
char * interface;
if (argc > 1) {
interface=argv[1];
}
else {
interface = "vboxnet0";
}
printf("Using interface %s\n", interface);
SampledValuesPublisher svPublisher = SampledValuesPublisher_create(interface);
SV_ASDU asdu1 = SampledValuesPublisher_addASDU(svPublisher, "svpub1", NULL, 1);