Hi Eduardo,<div><br></div><div>let's stick to English then :)</div><div>I believe the first problem is that you should change the STUN/TURN info on the code.</div><div>Try registering on <a href="http://numb.viagenie.ca/">http://numb.viagenie.ca/</a> and changing these two lines according to that:</div>
<div><div>//NUMB server</div><div> // g_object_set (G_OBJECT (agent), "stun-server", "66.228.45.110", "stun-server-port", 3478, NULL);</div></div><div><br></div><div>//set relay info</div><div>
<div>nice_agent_set_relay_info (agent, stream_id, 1, "66.228.45.110", 3478, <yourusername>,<yourpassword>, NICE_RELAY_TYPE_TURN_UDP))</div></div><div><br></div><div>You should be getting three candidates on each agent.</div>
<div><br></div><div>I had some problems with that service too, so I installed a STUN/TURN server on a publicly addressed machine.</div><div><br></div><div>PS: I'm sure that is not the cleanest code you have ever read :)</div>
<div><br></div><div>Cheers,</div><div>Tiago</div><div><br></div><div><div class="gmail_quote">On Fri, Jan 13, 2012 at 2:22 PM, Eduardo Bezerra <span dir="ltr"><<a href="mailto:kdubezerra@gmail.com">kdubezerra@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">hehe I think I can ask in Portuguese now, but then the discussion wouldn't be useful for many people<div><br></div>
<div>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:</div>
<div><br></div><div>"left" peer (lab):</div><div>==============================================</div><div><div>WAIT UNTIL YOU CHANGE FILES (when I did the scp exchange of cands and creds files)</div><div><br></div>
<div><br></div><div>READING CANDIDATES FROM FILE</div><div>READ 2 CANDIDATES FROM rightCands.bin.</div><div>PRINTING REMOTE CANDIDATES</div><div><br></div><div>CANDIDADE NUMBER 0:</div><div> NICE_CANDIDATE_TYPE_HOST</div>
<div> NICE_CANDIDATE_TRANSPORT_UDP</div><div><br></div><div>(process:62780): libnice-CRITICAL **: file address.c: line 259 (nice_address_to_string): should not be reached</div><div> ADDRESS: ?_? </div><div><br></div><div>
(process:62780): libnice-CRITICAL **: file address.c: line 259 (nice_address_to_string): should not be reached</div><div> BASE ADDRESS: ?_? </div><div> PRIORITY: 2013266431</div><div> STREAM_ID: 1</div><div> COMPONENT_ID: 1</div>
<div> FOUNDATION: 1</div><div> USERNAME: (null)</div><div> PASSWORD: (null)</div><div>CANDIDADE NUMBER 1:</div><div> NICE_CANDIDATE_TYPE_SERVER_REFLEXIVE</div><div> NICE_CANDIDATE_TRANSPORT_UDP</div><div><br></div><div>
(process:62780): libnice-CRITICAL **: file address.c: line 259 (nice_address_to_string): should not be reached</div><div> ADDRESS: ?_? </div><div><br></div><div>(process:62780): libnice-CRITICAL **: file address.c: line 259 (nice_address_to_string): should not be reached</div>
<div> BASE ADDRESS: ?_? </div><div> PRIORITY: 1677721855</div><div> STREAM_ID: 1</div><div> COMPONENT_ID: 1</div><div> FOUNDATION: 2</div><div> USERNAME: (null)</div><div> PASSWORD: (null)</div><div>READING REMOTE CREDENTIALS FILE</div>
<div><br></div><div>READING CREDENTIALS FROM FILE rightCreds.bin</div><div>REMOTE USER: ZTS/</div><div>REMOTE PWD: 8j74ohw6S68cwn/B4CnSpw</div><div>(process:62780): libnice-DEBUG: Agent 0x10082e800: set_remote_candidates 1 1</div>
<div>**</div><div>ERROR:../client.c:210:cb_candidate_gathering_done: assertion failed: (nice_agent_set_remote_candidates(agent, stream_id, 1, remoteCands))</div><div>Abort trap</div><div>==============================================</div>
<div><br></div><div><br></div><div><br></div><div>right peer (home):</div><div>==============================================</div><div><div>WRITING LOCAL CREDENTIALS TO FILE rightCreds.bin</div><div>WAIT UNTIL YOU CHANGE FILES</div>
<div><br></div><div><br></div><div>READING CANDIDATES FROM FILE</div><div>READ 1 CANDIDATES FROM leftCands.bin.</div><div>PRINTING REMOTE CANDIDATES</div><div><br></div><div>CANDIDADE NUMBER 0:</div><div> NICE_CANDIDATE_TYPE_HOST</div>
<div> NICE_CANDIDATE_TRANSPORT_UDP</div><div><br></div><div>(process:25636): libnice-CRITICAL **: file address.c: line 259 (nice_address_to_string): should not be reached</div><div> ADDRESS: </div><div><br></div><div>(process:25636): libnice-CRITICAL **: file address.c: line 259 (nice_address_to_string): should not be reached</div>
<div> BASE ADDRESS: </div><div> PRIORITY: 2013266431</div><div> STREAM_ID: 1</div><div> COMPONENT_ID: 1</div><div> FOUNDATION: 1</div><div> USERNAME: (null)</div><div> PASSWORD: (null)</div><div>READING REMOTE CREDENTIALS FILE</div>
<div><br></div><div>READING CREDENTIALS FROM FILE leftCreds.bin</div><div>REMOTE USER: wnj6</div><div>REMOTE PWD: c5ufACXFyUowlh98uQoMBs</div><div>(process:25636): libnice-DEBUG: Agent 0x1689eb0: set_remote_candidates 1 1</div>
<div>**</div><div>ERROR:../client.c:210:cb_candidate_gathering_done: assertion failed: (nice_agent_set_remote_candidates(agent, stream_id, 1, remoteCands))</div><div>Abortado</div></div><div>==============================================</div>
<div><br></div><div><br></div><div><br></div><div>Any hints?</div><span class="HOEnZb"><font color="#888888"><div><br></div><div><br></div><div>Eduardo</div></font></span><div><div class="h5">
<br><br><div class="gmail_quote">On Fri, Jan 13, 2012 at 10:38 AM, Tiago Sá <span dir="ltr"><<a href="mailto:tiagosa@di.uminho.pt" target="_blank">tiagosa@di.uminho.pt</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<div><br></div><div>thanks Youness for sharing. My application has evolved into a more complex one, with some other features.</div><div>Anyway, if you need any explanation for these examples, I can do my best.</div><div>
<br></div><div>Regards,</div><div>Tiago Sá<div><div><br><br><div class="gmail_quote">On Thu, Jan 12, 2012 at 9:24 PM, Youness Alaoui <span dir="ltr"><<a href="mailto:youness.alaoui@collabora.co.uk" target="_blank">youness.alaoui@collabora.co.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">It's a question that I get often. I hope to get some time to write a proper<br>
tutorial with some example code, in the meantime, I suggest reading old threads<br>
on this mailing list.<br>
Here is one thread specifically about starting with libnice which explains how<br>
to do, what the usual bugs/misconceptions are and some sample code is also shared :<br>
<a href="http://lists.freedesktop.org/archives/nice/2011-October/000442.html" target="_blank">http://lists.freedesktop.org/archives/nice/2011-October/000442.html</a><br>
<a href="http://lists.freedesktop.org/archives/nice/2011-October/000443.html" target="_blank">http://lists.freedesktop.org/archives/nice/2011-October/000443.html</a><br>
<a href="http://lists.freedesktop.org/archives/nice/2011-November/000449.html" target="_blank">http://lists.freedesktop.org/archives/nice/2011-November/000449.html</a><br>
<a href="http://lists.freedesktop.org/archives/nice/2011-November/000451.html" target="_blank">http://lists.freedesktop.org/archives/nice/2011-November/000451.html</a><br>
<a href="http://lists.freedesktop.org/archives/nice/2011-November/000456.html" target="_blank">http://lists.freedesktop.org/archives/nice/2011-November/000456.html</a><br>
<a href="http://lists.freedesktop.org/archives/nice/2011-November/000458.html" target="_blank">http://lists.freedesktop.org/archives/nice/2011-November/000458.html</a><br>
<a href="http://lists.freedesktop.org/archives/nice/2011-December/000467.html" target="_blank">http://lists.freedesktop.org/archives/nice/2011-December/000467.html</a><br>
<a href="http://lists.freedesktop.org/archives/nice/2011-December/000469.html" target="_blank">http://lists.freedesktop.org/archives/nice/2011-December/000469.html</a><br>
<br>
For some reason, the list archives doesn't save messages sent with the list as<br>
CC instead of TO.. so I don't have the messages from Tiago, but you can read<br>
them inlined in my own answers to him.<br>
In one of his mails he sent a sample program which I've attached to this mail.<br>
It's a bit more complex than a simple "libnice hello world", but it should give<br>
you an idea on how to use the API in a real life example.<br>
<br>
Let me know if you have any further questions.<br>
Youness.<br>
<div><br>
On 01/12/2012 11:49 AM, Eduardo Bezerra wrote:<br>
> Oh and by the way, I've seen the NiceAgent api page... Although that helped a<br>
> lot in understand what idiomatic libnice uses, it doesn't really establish any<br>
> "connection"...<br>
><br>
> On Thu, Jan 12, 2012 at 5:47 PM, Eduardo Bezerra <<a href="mailto:kdubezerra@gmail.com" target="_blank">kdubezerra@gmail.com</a><br>
</div><div>> <mailto:<a href="mailto:kdubezerra@gmail.com" target="_blank">kdubezerra@gmail.com</a>>> wrote:<br>
><br>
> Hi, I've been studying libnice, and now also glib, since it's build on top<br>
> of it (it definitely feels much better than going with libevent, imho).<br>
> However, I still couldn't figure out what I have to do to make two peers<br>
> talk to each other.<br>
><br>
> Could you guys provide some (link to a) few-lines, minimalistic example<br>
> application that traverses the nat with ice and then communicates with some<br>
> other endpoint? Maybe something like<br>
> this? <a href="http://content.gpwiki.org/index.php/SDL:Tutorial:Using_SDL_net" target="_blank">http://content.gpwiki.org/index.php/SDL:Tutorial:Using_SDL_net</a><br>
><br>
> Thanks a lot again!<br>
><br>
> Eduardo<br>
><br>
><br>
><br>
><br>
</div>> _______________________________________________<br>
> Nice mailing list<br>
> <a href="mailto:Nice@lists.freedesktop.org" target="_blank">Nice@lists.freedesktop.org</a><br>
> <a href="http://lists.freedesktop.org/mailman/listinfo/nice" target="_blank">http://lists.freedesktop.org/mailman/listinfo/nice</a><br>
<br>
<br>_______________________________________________<br>
Nice mailing list<br>
<a href="mailto:Nice@lists.freedesktop.org" target="_blank">Nice@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/nice" target="_blank">http://lists.freedesktop.org/mailman/listinfo/nice</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div></div></div><span><font color="#888888">-- <br>Tiago Sá<br>Universidade do Minho, Braga - Portugal<div><img> <a href="http://www.tiagosa.com" target="_blank">www.tiagosa.com</a><br>
</div><br>
</font></span></div>
<br>_______________________________________________<br>
Nice mailing list<br>
<a href="mailto:Nice@lists.freedesktop.org" target="_blank">Nice@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/nice" target="_blank">http://lists.freedesktop.org/mailman/listinfo/nice</a><br>
<br></blockquote></div><br></div></div></div>
<br>_______________________________________________<br>
Nice mailing list<br>
<a href="mailto:Nice@lists.freedesktop.org">Nice@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/nice" target="_blank">http://lists.freedesktop.org/mailman/listinfo/nice</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>Tiago Sá<br>Universidade do Minho, Braga - Portugal<div><img src="http://wac.2659.edgecastcdn.net/802659/production80/images/icons/favicon.ico"> <a href="http://www.tiagosa.com" target="_blank">www.tiagosa.com</a><br>
</div><br>
</div>