summaryrefslogtreecommitdiff
path: root/src/daemon/dlt_daemon_socket.c
diff options
context:
space:
mode:
authorStefan Vacek <stefan.vacek@intel.com>2015-08-31 10:13:07 +0200
committerAlexander Wenzel <Alexander.AW.Wenzel@bmw.de>2015-10-07 10:38:03 +0200
commited412acac8e9f8a5745e55adeed9652b34b9ee4f (patch)
treedd2dbde29e126c679218b7cf93455601bbeca9bd /src/daemon/dlt_daemon_socket.c
parent4c8d43322e89b87288fb5ba12e523237e620481b (diff)
downloadDLT-daemon-ed412acac8e9f8a5745e55adeed9652b34b9ee4f.tar.gz
Allow multiple instances of dlt-daemon
- Make dlt-daemon configurable to specify directory of fifos and port of dlt-daemon, this allows to run multiple instances of dlt-daemon at one node at the same time. This is useful in testing environment where simultanous tests should not interfere due to the same instance of dlt-daemon - dlt-daemon: add option -t <dir> to specify a directory where all fifos will be created - dlt-daemon: add option -p <port> to specify the port under which dlt-daemon can be connected - client-library: add environment variable DLT_PIPE_DIR to specify a non-default directory of fifos for logging applications - client-library: add environment variable DLT_DAEMON_TCP_PORT to specify the port under which dlt-daemon can be reached (especially when using dlt-receive) Signed-off-by: Stefan Vacek <stefan.vacek@intel.com> Signed-off-by: Lutz Helwing <lutz_helwing@mentor.com>
Diffstat (limited to 'src/daemon/dlt_daemon_socket.c')
-rw-r--r--src/daemon/dlt_daemon_socket.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/daemon/dlt_daemon_socket.c b/src/daemon/dlt_daemon_socket.c
index 709868f..fa91485 100644
--- a/src/daemon/dlt_daemon_socket.c
+++ b/src/daemon/dlt_daemon_socket.c
@@ -63,7 +63,7 @@
/** Global text output buffer, mainly used for creation of error/warning strings */
static char str[DLT_DAEMON_TEXTBUFSIZE];
-int dlt_daemon_socket_open(int *sock)
+int dlt_daemon_socket_open(int *sock, unsigned int servPort)
{
int yes = 1;
char portnumbuffer[33];
@@ -75,7 +75,7 @@ int dlt_daemon_socket_open(int *sock)
hints.ai_socktype = SOCK_STREAM;
hints.ai_flags = AI_PASSIVE; // use my IP address
- sprintf(portnumbuffer, "%d", DLT_DAEMON_TCP_PORT);
+ snprintf(portnumbuffer, 32, "%d", servPort);
if ((rv = getaddrinfo(NULL, portnumbuffer, &hints, &servinfo)) != 0) {
snprintf(str, DLT_DAEMON_TEXTBUFSIZE, "getaddrinfo: %s\n", gai_strerror(rv));
dlt_log(LOG_WARNING, str);
@@ -115,7 +115,7 @@ int dlt_daemon_socket_open(int *sock)
freeaddrinfo(servinfo);
- snprintf(str, DLT_DAEMON_TEXTBUFSIZE, "%s: Listening on port: %u\n", __FUNCTION__, DLT_DAEMON_TCP_PORT);
+ snprintf(str, DLT_DAEMON_TEXTBUFSIZE, "%s: Listening on port: %u\n", __FUNCTION__, servPort);
dlt_log(LOG_INFO, str);
// get socket buffer size