[libnice] how does libnice keep a connection alive

Philip Withnall philip at tecnocode.co.uk
Thu Sep 24 15:54:21 PDT 2015


Hey,

On Tue, 2015-09-22 at 21:36 -0700, tom chen wrote:
> I am very new to ICE, I am confused how libnice keep alive the
> selected IP and port number? I am wondering if libnice creates a
> socket using the local candidate’s port number, binds with the
> candidates’s IP address, then use the socket to periodically send
> some commands to keep the connection alive. If so, since the
> candidates’ IP address and port number have been used by libnice
> refreshing thread, how can we create a socket to use that candidate’s
> IP & port to transport media stream?

There is a whole section on this in the ICE specification (RFC 5245,
§10): https://tools.ietf.org/html/rfc5245#section-10

Basically, if you’re using ICE over UDP, all your data is wrapped in
the STUN protocol, which means libnice can send no-op STUN binding
messages as keepalives.

This works because to use libnice, you must send all your packets
through it, using nice_agent_send_messages_nonblocking() and
nice_agent_receive_messages().

Philip
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 213 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/nice/attachments/20150924/31e73bb0/attachment.sig>


More information about the nice mailing list