[libnice] How to properly use the function nice_agent_get_io_stream()

silvio silvio.frischi at gmail.com
Sun May 11 14:31:07 PDT 2014


> If you want to use the GIOStream interface, you must start reading from
> the GInputStream immediately so that packets are received. The
> connection will not happen unless you are reading.
> 

Thanks. I have run in to some other trouble using libnice-0.1.5.

1) g_input_stream_read()

When using unix read() or recv(), they usually block until some input is
available. Then that input is written to the buffer and the function
returns.

g_input_stream_read() here seems to wait until the entire buffer can be
filled. I don't know glib at all but I would think that is what
g_input_stream_read_all() is for.

I tricked libnice into that behavior by using combining.

nice_agent_recv(... 1 ...);
nice_agent_recv_nonblocking(... buffer_size-1 ...);

However, this would be better solved in the library.

2) onesided shutdown of pseudo tcp:

If i do close the GOutputStream of GIOStream nothing seams to happen.
Ideally the TCP connection would be half closed. And any reading
function on the other side would return eof.

This is required for even simple things like netcat. Imagine how netcat
terminates if you connect like this to a simple echo server.

echo foo | nc echoserver.example.org echoport

3) timeout

when i kill one of the participants i see that some packets are still
sent from the other periodically but the other participant never fires
component-state-changed signal. I would except it to go into some fail
state after some timeout.


p.s. cool hat

Silvio


More information about the nice mailing list