Change in libosmo-netif[master]: Stream examples: print accepted client address

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Max gerrit-no-reply at lists.osmocom.org
Mon Feb 4 14:05:44 UTC 2019


Max has uploaded this change for review. ( https://gerrit.osmocom.org/12826


Change subject: Stream examples: print accepted client address
......................................................................

Stream examples: print accepted client address

Display socket information for accepted client.

Change-Id: I5aa6757be79754cf7ffa4a276dae1cfb80fe904e
---
M examples/stream-server.c
1 file changed, 6 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/26/12826/1

diff --git a/examples/stream-server.c b/examples/stream-server.c
index e208d88..14b4123 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 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 @@
 		return -1;
 	}
 
+	osmo_sock_get_name_buf(buf, OSMO_SOCK_NAME_MAXLEN, fd);
+	LOGP(DSTREAMTEST, LOGL_NOTICE, "accepted client: %s\n", buf);
+
 	return 0;
 }
 

-- 
To view, visit https://gerrit.osmocom.org/12826
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I5aa6757be79754cf7ffa4a276dae1cfb80fe904e
Gerrit-Change-Number: 12826
Gerrit-PatchSet: 1
Gerrit-Owner: Max <msuraev at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190204/10163474/attachment.htm>


More information about the gerrit-log mailing list