[Nice] minimal example

Eduardo Bezerra kdubezerra at gmail.com
Fri Jan 13 06:22:21 PST 2012


hehe I think I can ask in Portuguese now, but then the discussion wouldn't
be useful for many people

so, I tested Tiago's code, which ran fine if both peers are on the same
machine. However, I started two peers, each under a different NAT (one at
home and one at the lab) and exchanged the candidates and credentials files
through scp in the middle of the execution (thanks to the getchar() call).
However, I got the following output then:

"left" peer (lab):
==============================================
WAIT UNTIL YOU CHANGE FILES (when I did the scp exchange of cands and creds
files)


READING CANDIDATES FROM FILE
READ 2 CANDIDATES FROM rightCands.bin.
PRINTING REMOTE CANDIDATES

CANDIDADE NUMBER 0:
  NICE_CANDIDATE_TYPE_HOST
  NICE_CANDIDATE_TRANSPORT_UDP

(process:62780): libnice-CRITICAL **: file address.c: line 259
(nice_address_to_string): should not be reached
  ADDRESS:  ?_?

(process:62780): libnice-CRITICAL **: file address.c: line 259
(nice_address_to_string): should not be reached
  BASE ADDRESS:  ?_?
  PRIORITY: 2013266431
  STREAM_ID: 1
  COMPONENT_ID: 1
  FOUNDATION: 1
  USERNAME: (null)
  PASSWORD: (null)
CANDIDADE NUMBER 1:
  NICE_CANDIDATE_TYPE_SERVER_REFLEXIVE
  NICE_CANDIDATE_TRANSPORT_UDP

(process:62780): libnice-CRITICAL **: file address.c: line 259
(nice_address_to_string): should not be reached
  ADDRESS:  ?_?

(process:62780): libnice-CRITICAL **: file address.c: line 259
(nice_address_to_string): should not be reached
  BASE ADDRESS:  ?_?
  PRIORITY: 1677721855
  STREAM_ID: 1
  COMPONENT_ID: 1
  FOUNDATION: 2
  USERNAME: (null)
  PASSWORD: (null)
READING REMOTE CREDENTIALS FILE

READING CREDENTIALS FROM FILE rightCreds.bin
REMOTE USER: ZTS/
REMOTE PWD: 8j74ohw6S68cwn/B4CnSpw
(process:62780): libnice-DEBUG: Agent 0x10082e800: set_remote_candidates 1 1
**
ERROR:../client.c:210:cb_candidate_gathering_done: assertion failed:
(nice_agent_set_remote_candidates(agent, stream_id, 1, remoteCands))
Abort trap
==============================================



right peer (home):
==============================================
WRITING LOCAL CREDENTIALS TO FILE rightCreds.bin
WAIT UNTIL YOU CHANGE FILES


READING CANDIDATES FROM FILE
READ 1 CANDIDATES FROM leftCands.bin.
PRINTING REMOTE CANDIDATES

CANDIDADE NUMBER 0:
  NICE_CANDIDATE_TYPE_HOST
  NICE_CANDIDATE_TRANSPORT_UDP

(process:25636): libnice-CRITICAL **: file address.c: line 259
(nice_address_to_string): should not be reached
  ADDRESS:

(process:25636): libnice-CRITICAL **: file address.c: line 259
(nice_address_to_string): should not be reached
  BASE ADDRESS:
  PRIORITY: 2013266431
  STREAM_ID: 1
  COMPONENT_ID: 1
  FOUNDATION: 1
  USERNAME: (null)
  PASSWORD: (null)
READING REMOTE CREDENTIALS FILE

READING CREDENTIALS FROM FILE leftCreds.bin
REMOTE USER: wnj6
REMOTE PWD: c5ufACXFyUowlh98uQoMBs
(process:25636): libnice-DEBUG: Agent 0x1689eb0: set_remote_candidates 1 1
**
ERROR:../client.c:210:cb_candidate_gathering_done: assertion failed:
(nice_agent_set_remote_candidates(agent, stream_id, 1, remoteCands))
Abortado
==============================================



Any hints?


Eduardo


On Fri, Jan 13, 2012 at 10:38 AM, Tiago Sá <tiagosa at di.uminho.pt> wrote:

> Hi,
>
> thanks Youness for sharing. My application has evolved into a more complex
> one, with some other features.
> Anyway, if you need any explanation for these examples, I can do my best.
>
> Regards,
> Tiago Sá
>
>
> On Thu, Jan 12, 2012 at 9:24 PM, Youness Alaoui <
> youness.alaoui at collabora.co.uk> wrote:
>
>> It's a question that I get often. I hope to get some time to write a
>> proper
>> tutorial with some example code, in the meantime, I suggest reading old
>> threads
>> on this mailing list.
>> Here is one thread specifically about starting with libnice which
>> explains how
>> to do, what the usual bugs/misconceptions are and some sample code is
>> also shared :
>> http://lists.freedesktop.org/archives/nice/2011-October/000442.html
>> http://lists.freedesktop.org/archives/nice/2011-October/000443.html
>> http://lists.freedesktop.org/archives/nice/2011-November/000449.html
>> http://lists.freedesktop.org/archives/nice/2011-November/000451.html
>> http://lists.freedesktop.org/archives/nice/2011-November/000456.html
>> http://lists.freedesktop.org/archives/nice/2011-November/000458.html
>> http://lists.freedesktop.org/archives/nice/2011-December/000467.html
>> http://lists.freedesktop.org/archives/nice/2011-December/000469.html
>>
>> For some reason, the list archives doesn't save messages sent with the
>> list as
>> CC instead of TO.. so I don't have the messages from Tiago, but you can
>> read
>> them inlined in my own answers to him.
>> In one of his mails he sent a sample program which I've attached to this
>> mail.
>> It's a bit more complex than a simple "libnice hello world", but it
>> should give
>> you an idea on how to use the API in a real life example.
>>
>> Let me know if you have any further questions.
>> Youness.
>>
>> On 01/12/2012 11:49 AM, Eduardo Bezerra wrote:
>> > Oh and by the way, I've seen the NiceAgent api page... Although that
>> helped a
>> > lot in understand what idiomatic libnice uses, it doesn't really
>> establish any
>> > "connection"...
>> >
>> > On Thu, Jan 12, 2012 at 5:47 PM, Eduardo Bezerra <kdubezerra at gmail.com
>> > <mailto:kdubezerra at gmail.com>> wrote:
>> >
>> >     Hi, I've been studying libnice, and now also glib, since it's build
>> on top
>> >     of it (it definitely feels much better than going with libevent,
>> imho).
>> >     However, I still couldn't figure out what I have to do to make two
>> peers
>> >     talk to each other.
>> >
>> >     Could you guys provide some (link to a) few-lines, minimalistic
>> example
>> >     application that traverses the nat with ice and then communicates
>> with some
>> >     other endpoint? Maybe something like
>> >     this?
>> http://content.gpwiki.org/index.php/SDL:Tutorial:Using_SDL_net
>> >
>> >     Thanks a lot again!
>> >
>> >     Eduardo
>> >
>> >
>> >
>> >
>> > _______________________________________________
>> > Nice mailing list
>> > Nice at lists.freedesktop.org
>> > http://lists.freedesktop.org/mailman/listinfo/nice
>>
>>
>> _______________________________________________
>> Nice mailing list
>> Nice at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/nice
>>
>>
>
>
> --
> Tiago Sá
> Universidade do Minho, Braga - Portugal
>  www.tiagosa.com
>
>
> _______________________________________________
> Nice mailing list
> Nice at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/nice
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/nice/attachments/20120113/4bdc61ab/attachment-0001.htm>


More information about the Nice mailing list