aboutsummaryrefslogtreecommitdiffstats
path: root/examples/stream-client.c
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@gnumonks.org>2011-10-17 12:50:58 +0200
committerPablo Neira Ayuso <pablo@gnumonks.org>2011-10-17 12:51:18 +0200
commit98ec00d8d22fa855710a13aa21cfe1f66114a55b (patch)
tree29b937eff0b85144385df2e128f3ec5b99f24dde /examples/stream-client.c
parentc43bb089067ca05af4992fbafe46827a1f0a6e9b (diff)
stream: add osmo_stream_*_conn_recv
Like c43bb089067ca05af4992fbafe46827a1f0a6e9b but for stream sockets.
Diffstat (limited to 'examples/stream-client.c')
-rw-r--r--examples/stream-client.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/examples/stream-client.c b/examples/stream-client.c
index 7f95800..8836223 100644
--- a/examples/stream-client.c
+++ b/examples/stream-client.c
@@ -43,9 +43,22 @@ static int connect_cb(struct osmo_stream_client_conn *conn)
return 0;
}
-static int read_cb(struct osmo_stream_client_conn *conn, struct msgb *msg)
+static int read_cb(struct osmo_stream_client_conn *conn)
{
+ struct msgb *msg;
+
LOGP(DSTREAMTEST, LOGL_NOTICE, "received message from stream\n");
+
+ msg = msgb_alloc(1024, "STREAMCLIENT/test");
+ if (msg == NULL) {
+ LOGP(DSTREAMTEST, LOGL_ERROR, "cannot allocate message\n");
+ return 0;
+ }
+ if (osmo_stream_client_conn_recv(conn, msg) < 0) {
+ LOGP(DSTREAMTEST, LOGL_ERROR, "cannot receive message\n");
+ return 0;
+ }
+ msgb_free(msg);
return 0;
}