Hi again Youness,<div>thanks a lot for your help.</div><div>I believe I solved the problems you pointed before.</div><div>I am using a dumb method to exchange candidates. I write them to file and exchange them using a ftp server (I will improve it later).</div>
<div><br></div><div>So, the way I run it is:</div><div>(HostA) ./client l</div><div>(HostB) ./client r</div><div>//local candidates are gathered and written to file</div><div>(HostA) put leftCands.bin on FTP and get rightCands.bin</div>
<div>(HostB) put rightCands.bin on FTP and get leftCands.bin</div><div>//read local credentials and write them on the remote host</div><div><br></div><div>I am using a relay server, that should work as a last resort. But during the local candidate gathering, sometimes it gets a relayed candidate, but most of the times it doesn't. Can it be related with timeouts?</div>
<div><br></div><div>Either way, it can never get a pair a establish a connection. :(</div><div>I don't have a clue why this happens..</div><div><br></div><div>Can you please have a look?</div><div><br></div><div>Cheers,</div>
<div>Tiago</div><div><br></div><div><br><div class="gmail_quote">On Fri, Nov 4, 2011 at 2:03 PM, Youness Alaoui <span dir="ltr"><<a href="mailto:youness.alaoui@collabora.co.uk">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;">Hi again Tiago,<br>
<br>
For the remote candidates, you will need a third party server to exchange that<br>
information, usually the candidates would be sent over SIP or XMPP for example.<br>
ICE cannot work if you don't have a third party server with which you can<br>
reliably exchange candidates. For testing purposes you could have it print the<br>
candidates to stdout, and you could copy/paste that into stdin of the other<br>
instance and have it parse the input.. or you could hardcode a port to connect<br>
to and do the candidate exchange.. there's no easy way of doing that though.<br>
You cannot hardcode the candidates because the port used will be random<br>
everytime, also, you will need to exchange the randomly generated<br>
username/password (nice_agent_get_local_credentials +<br>
nice_agent_set_remote_credentials) to make the connectivity checks work.<br>
<br>
As for your example, here are a few comments :<br>
1 - you call the nice_agent_set_relay_info with stream_id being uninitialized,<br>
you must call it *after* you do the nice_agent_add_stream...<br>
2 - you don't need those GValues, you can just do<br>
g_object_set (G_OBJECT(agent),<br>
"stun-server", "66.228.45.110",<br>
"stun-server-port", 3478,<br>
NULL);<br>
3 - You shouldn't set the remote credentials as the same as the local ones<br>
4 - In your print_candidate_info, you may also want to print the port used.<br>
<br>
I hope this helps, let me know if you have further questions.<br>
<br>
Youness.<br>
<div class="im"><br>
<br>
On 11/03/2011 12:57 PM, Tiago Sá wrote:<br>
> Hi Youness,<br>
><br>
> I have been trying to create a simple application based on the first link you<br>
> pointed before.<br>
> Thanks for the tips you gave me. I have a couple of questions though, if you can<br>
> help me.<br>
><br>
> I need to find a way to get the remote candidates passed from a peer to another.<br>
> Can you point an easy way to do that?<br>
> Could I hardcode the remote candidates list, for testing purposes?<br>
><br>
> Right now, I only get two local candidates (HOST and SERVER_REFLEXIVE).<br>
> I am trying to use the numb TURN server, shouldn't I get a RELAYED candidate too?<br>
><br>
> I am attaching the code. Can you please have a look at the code and check where<br>
> the error could be?<br>
><br>
> Thanks for helping!<br>
><br>
> Regards,<br>
> Tiago Sá<br>
><br>
><br>
> On Wed, Oct 19, 2011 at 10:53 PM, Youness Alaoui <<a href="mailto:youness.alaoui@collabora.co.uk">youness.alaoui@collabora.co.uk</a><br>
</div><div><div class="h5">> <mailto:<a href="mailto:youness.alaoui@collabora.co.uk">youness.alaoui@collabora.co.uk</a>>> wrote:<br>
><br>
> Hi,<br>
><br>
> Welcome to the world of libnice :)<br>
> Yes, doing NAT traversal is far from being easy, the only solution is pretty<br>
> much to use the ICE specification and that's not easy to implement, so that's<br>
> why you'd need to use libnice.<br>
><br>
> For an example, you can have a look at the unit tests, like<br>
> tests/test-fullmode.c for example, although that does a lot of stuff. You can<br>
> see a quick example in the documentation for NiceAgent :<br>
> <a href="http://nice.freedesktop.org/libnice/NiceAgent.html" target="_blank">http://nice.freedesktop.org/libnice/NiceAgent.html</a><br>
><br>
> For smaller examples, you can look at the libnice mailing list archives, some<br>
> people posted their example code where they were having problems. For example, a<br>
> very simple example can be seen here :<br>
> <a href="http://lists.freedesktop.org/archives/nice/2011-January/000404.html" target="_blank">http://lists.freedesktop.org/archives/nice/2011-January/000404.html</a><br>
> But make sure to click on the "Next message" to read the whole thread because<br>
> that example had a bug that I explained how to fix in the following emails.<br>
> Same for this thread :<br>
> <a href="http://lists.freedesktop.org/archives/nice/2011-October/000434.html" target="_blank">http://lists.freedesktop.org/archives/nice/2011-October/000434.html</a><br>
><br>
> I hope that helps,<br>
> Youness.<br>
><br>
> On 10/19/2011 09:58 AM, Tiago Sá wrote:<br>
> > Hi all,<br>
> ><br>
> > my name is Tiago Sá, I am a junior researcher from Portugal and this is my<br>
> first<br>
> > mail to this list.<br>
> > I have a NAT traversal problem to solve and I have been looking for a solution<br>
> > during the last weeks, which, as I found out, is not so trivial as I<br>
> thought before.<br>
> > As stated on the libnice homepage, libnice seems to be what I am looking for:<br>
> ><br>
> > "ICE is useful for applications that want to establish peer-to-peer<br>
> UDP data<br>
> > streams. It automates the process of traversing NATs and provides security<br>
> > against some attacks. It also allows applications to create reliable<br>
> streams<br>
> > using a TCP over UDP layer."<br>
> ><br>
> ><br>
> > I have been looking for the provided documentation and I am feeling kind<br>
> of lost.<br>
> > Is there any example application or tutorial to get started?<br>
> > Could you please share a basic application of this kind or point me a<br>
> direction?<br>
> ><br>
> ><br>
> > Thanks in advance for your help.<br>
> ><br>
> > Regards,<br>
> > Tiago Sá<br>
> ><br>
> > --<br>
> > Tiago Sá<br>
> > Universidade do Minho, Braga - Portugal<br>
> ><br>
> > <a href="http://about.me/tiagosa/" target="_blank">http://about.me/tiagosa/</a><br>
> ><br>
> ><br>
> ><br>
> > _______________________________________________<br>
> > Nice mailing list<br>
</div></div>> > <a href="mailto:Nice@lists.freedesktop.org">Nice@lists.freedesktop.org</a> <mailto:<a href="mailto:Nice@lists.freedesktop.org">Nice@lists.freedesktop.org</a>><br>
<div class="im">> > <a href="http://lists.freedesktop.org/mailman/listinfo/nice" target="_blank">http://lists.freedesktop.org/mailman/listinfo/nice</a><br>
><br>
><br>
><br>
> _______________________________________________<br>
> Nice mailing list<br>
</div>> <a href="mailto:Nice@lists.freedesktop.org">Nice@lists.freedesktop.org</a> <mailto:<a href="mailto:Nice@lists.freedesktop.org">Nice@lists.freedesktop.org</a>><br>
<div class="im">> <a href="http://lists.freedesktop.org/mailman/listinfo/nice" target="_blank">http://lists.freedesktop.org/mailman/listinfo/nice</a><br>
><br>
><br>
><br>
><br>
> --<br>
> Tiago Sá<br>
> Universidade do Minho, Braga - Portugal<br>
</div>> <a href="http://www.tiagosa.com" target="_blank">www.tiagosa.com</a> <<a href="http://www.tiagosa.com" target="_blank">http://www.tiagosa.com</a>><br>
><br>
<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>