diff options
author | Max <msuraev@sysmocom.de> | 2019-02-04 14:54:15 +0100 |
---|---|---|
committer | Max <msuraev@sysmocom.de> | 2019-02-05 15:09:28 +0000 |
commit | dee873489f57c87c2bc12ab0ea17c0cb62a19617 (patch) | |
tree | d951c4959163ce37483a915d5217c6af57dde135 /examples | |
parent | e3366cf1446cf4bea1ab740c4b12d14b3c996eaf (diff) |
Stream examples: print accepted client address
Display socket information for accepted client.
Change-Id: I5aa6757be79754cf7ffa4a276dae1cfb80fe904e
Diffstat (limited to 'examples')
-rw-r--r-- | examples/stream-server.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/examples/stream-server.c b/examples/stream-server.c index 31487a0..b02eefe 100644 --- a/examples/stream-server.c +++ b/examples/stream-server.c @@ -5,6 +5,7 @@ #include <unistd.h> #include <osmocom/core/select.h> +#include <osmocom/core/socket.h> #include <osmocom/core/talloc.h> #include <osmocom/core/msgb.h> #include <osmocom/core/logging.h> @@ -77,6 +78,8 @@ static int close_cb(struct osmo_stream_srv *dummy) static int accept_cb(struct osmo_stream_srv_link *srv, int fd) { + char buf[OSMO_SOCK_NAME_MAXLEN]; + if (conn != NULL) { LOGP(DSTREAMTEST, LOGL_ERROR, "Sorry, this example only " "support one client simultaneously\n"); @@ -91,6 +94,9 @@ static int accept_cb(struct osmo_stream_srv_link *srv, int fd) return -1; } + osmo_sock_get_name_buf(buf, OSMO_SOCK_NAME_MAXLEN, fd); + LOGP(DSTREAMTEST, LOGL_NOTICE, "accepted client: %s\n", buf); + return 0; } |