[Nice] minimal example

Eduardo Bezerra kdubezerra at gmail.com
Fri Jan 13 07:02:20 PST 2012


I was using stunserver.org:3478 and I'm not setting a relay (turn) server,
since I don't really want my application to support that, at least for
now...

So, I think I kinda figured it out, just don't know how to solve it yet :)

the lab peer is running on a mac os x (10.6.8) and the right one is on
ubuntu (10.10 x86_64), so I guess writing the candidates structs to a
binary file and reading in a different os is causing this bug. I will run
now the left peer on a virtual machine with exactly the same os and post
the results to you guys to keep you updated...

(by the way, should I clean up the previous e-mails from my reply?)

On Fri, Jan 13, 2012 at 3:49 PM, Tiago Sá <tiagosa at di.uminho.pt> wrote:

> Hi Eduardo,
>
> let's stick to English then :)
> I believe the first problem is that you should change the STUN/TURN info
> on the code.
> Try registering on http://numb.viagenie.ca/ and changing these two lines
> according to that:
> //NUMB server
>  // g_object_set (G_OBJECT (agent), "stun-server", "66.228.45.110",
> "stun-server-port", 3478, NULL);
>
> //set relay info
> nice_agent_set_relay_info (agent, stream_id, 1, "66.228.45.110", 3478,
> <yourusername>,<yourpassword>, NICE_RELAY_TYPE_TURN_UDP))
>
> You should be getting three candidates on each agent.
>
> I had some problems with that service too, so I installed a STUN/TURN
> server on a publicly addressed machine.
>
> PS: I'm sure that is not the cleanest code you have ever read :)
>
> Cheers,
> Tiago
>
> On Fri, Jan 13, 2012 at 2:22 PM, Eduardo Bezerra <kdubezerra at gmail.com>wrote:
>
>> 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
>>>
>>>
>>
>> _______________________________________________
>> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/nice/attachments/20120113/72537e61/attachment-0001.htm>


More information about the Nice mailing list