diff options
author | Christian Muck <christian.muck@bmw.de> | 2014-01-10 13:58:56 +0100 |
---|---|---|
committer | Alexander Wenzel <Alexander.AW.Wenzel@bmw.de> | 2014-01-23 13:49:39 +0100 |
commit | 796fed63c4b8f060829e5ae4df9b6a74422206b9 (patch) | |
tree | f8bfa7cc54eeedf4e35dbe8026a7499b7f808523 | |
parent | 912c8f6887b6007c474ca6c1c3134c25936ab982 (diff) | |
download | DLT-daemon-796fed63c4b8f060829e5ae4df9b6a74422206b9.tar.gz |
Added log output of created socket/port In init phase 2 - socket creation
Signed-off-by: Alexander Wenzel <Alexander.AW.Wenzel@bmw.de>
-rw-r--r-- | src/daemon/dlt_daemon_socket.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/daemon/dlt_daemon_socket.c b/src/daemon/dlt_daemon_socket.c index 1492831..12f16a8 100644 --- a/src/daemon/dlt_daemon_socket.c +++ b/src/daemon/dlt_daemon_socket.c @@ -82,16 +82,21 @@ static char str[DLT_DAEMON_TEXTBUFSIZE]; int dlt_daemon_socket_open(int *sock) { int yes = 1; - + int socket_family = PF_INET; + int socket_type = SOCK_STREAM; + int protocol = IPPROTO_TCP; struct sockaddr_in servAddr; unsigned int servPort = DLT_DAEMON_TCP_PORT; - if ((*sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) + if ((*sock = socket(socket_family, socket_type, protocol)) < 0) { dlt_log(LOG_ERR, "dlt_daemon_socket_open: socket() failed!\n"); return -1; } /* if */ + sprintf(str,"%s: Socket created - socket_family:%i, socket_type:%i, protocol:%i\n", __FUNCTION__, socket_family, socket_type, protocol); + dlt_log(LOG_INFO, str); + if ( -1 == setsockopt(*sock, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(int))) { sprintf(str,"dlt_daemon_socket_open: Setsockopt error in dlt_daemon_local_connection_init: %s\n",strerror(errno)); @@ -115,6 +120,9 @@ int dlt_daemon_socket_open(int *sock) return -1; } /* if */ + sprintf(str,"%s: Listening on port: %u\n",__FUNCTION__,servPort); + dlt_log(LOG_INFO, str); + /* get socket buffer size */ sprintf(str,"dlt_daemon_socket_open: Socket send queue size: %d\n",dlt_daemon_socket_get_send_qeue_max_size(*sock)); dlt_log(LOG_INFO, str); |