From aa0d2e2181e0ca8b42c839b7fc23e8f5bc15f58a Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 16 Mar 2021 00:55:15 +0100 Subject: dlt-receive: Add option to configure port of dlt receive (#293) Signed-off-by: Alexander Mohr --- src/console/dlt-receive.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/console/dlt-receive.c') diff --git a/src/console/dlt-receive.c b/src/console/dlt-receive.c index 0421937..085648f 100644 --- a/src/console/dlt-receive.c +++ b/src/console/dlt-receive.c @@ -129,6 +129,7 @@ typedef struct { int part_num; /* number of current output file if limit was exceeded */ DltFile file; DltFilter filter; + int port; } DltReceiveData; /** @@ -160,6 +161,8 @@ void usage() printf(" When limit is reached, a new file is opened. Use K,M,G as\n"); printf(" suffix to specify kilo-, mega-, giga-bytes respectively\n"); printf(" -f filename Enable filtering of messages\n"); + printf(" -p port Use the given port instead the default port\n"); + printf(" Cannot be used with serial devices\n"); } @@ -331,6 +334,7 @@ int main(int argc, char *argv[]) dltdata.ohandle = -1; dltdata.totalbytes = 0; dltdata.part_num = -1; + dltdata.port = 3490; /* Config signal handler */ struct sigaction act; @@ -344,7 +348,7 @@ int main(int argc, char *argv[]) /* Fetch command line arguments */ opterr = 0; - while ((c = getopt (argc, argv, "vashyuxmf:o:e:b:c:")) != -1) + while ((c = getopt (argc, argv, "vashyuxmf:o:e:b:c:p:")) != -1) switch (c) { case 'v': { @@ -420,6 +424,11 @@ int main(int argc, char *argv[]) dltdata.bvalue = atoi(optarg); break; } + case 'p': + { + dltdata.port = atoi(optarg); + break; + } case 'c': { @@ -469,6 +478,7 @@ int main(int argc, char *argv[]) } if (dltclient.mode == DLT_CLIENT_MODE_TCP || dltclient.mode == DLT_CLIENT_MODE_UDP_MULTICAST) { + dltclient.port = dltdata.port; for (index = optind; index < argc; index++) if (dlt_client_set_server_ip(&dltclient, argv[index]) == -1) { fprintf(stderr, "set server ip didn't succeed\n"); -- cgit v1.2.1