diff options
author | Youness Alaoui <youness.alaoui@collabora.co.uk> | 2013-02-04 20:07:14 -0500 |
---|---|---|
committer | Youness Alaoui <youness.alaoui@collabora.co.uk> | 2013-02-04 20:07:14 -0500 |
commit | 818427d0b9e6d34d6ceb05cb73c1bf41446c9050 (patch) | |
tree | c8c073173946fbe1c02f02b44d2955496979a125 /examples | |
parent | bcd83b68953a6b9e204c60fb42f4105952f69b1b (diff) | |
download | libnice-818427d0b9e6d34d6ceb05cb73c1bf41446c9050.tar.gz |
example: Exit on Ctrl-D and send EOS signal to the other end
Diffstat (limited to 'examples')
-rw-r--r-- | examples/simple-example.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/examples/simple-example.c b/examples/simple-example.c index 2ffd8b0..f8b2688 100644 --- a/examples/simple-example.c +++ b/examples/simple-example.c @@ -252,6 +252,10 @@ stdin_send_data_cb (GIOChannel *source, GIOCondition cond, g_free (line); printf("> "); fflush (stdout); + } else { + nice_agent_send(agent, stream_id, 1, 1, "\0"); + // Ctrl-D was pressed. + g_main_loop_quit (gloop); } return TRUE; @@ -269,6 +273,8 @@ static void cb_nice_recv(NiceAgent *agent, guint stream_id, guint component_id, guint len, gchar *buf, gpointer data) { + if (len == 1 && buf[0] == '\0') + g_main_loop_quit (gloop); printf("%.*s", len, buf); fflush(stdout); } |