Hi Youness,<div><br></div><div>I have a simple question for you:</div><div>Is there any way to close the "connection" to the other agent? Let him know that you have terminated sending data?</div><div><br></div><div>
Just unrefing the agent doesn't work.</div><div><br></div><div>Thanks,</div><div>Tiago<br><br><div class="gmail_quote">On Fri, Dec 16, 2011 at 10:42 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"><div class="im">On 12/16/2011 06:41 AM, Tiago Sá wrote:<br>
> Hi Youness,<br>
><br>
> Sure! I will share the application when I succeed.<br>
</div>cool :)<br>
<div class="im"><br>
> Before trying to pipe from a local socket I am simply testing reading from a<br>
> file and sending that data to the other agent.<br>
> I am using nice_agent_new_reliable and pseudo_tcp is opened:<br>
> "(process:11881): libnice-DEBUG: Agent 0xb97de0: s1:1 pseudo Tcp socket Opened"<br>
> Can I assume that Nice will manage the acknowledgments, sequencing and all that<br>
> TCP stuff?<br>
</div>Yes, libnice will handle all of that, you still use the libnice API the same<br>
way, *but* there is a small difference between a normal agent and a reliable<br>
agent. I will explain it below.<br>
<div><div class="h5"><br>
><br>
> This is the function I use to slice and send the file:<br>
><br>
> int send_file(char *filename){<br>
> FILE *file = fopen(filename, "rb");<br>
> char *file_chunk = malloc(CHUNK_SIZE);<br>
><br>
> size_t nbytes = 0;<br>
> int sent=0;<br>
> while ( (nbytes = fread(file_chunk, sizeof(char), CHUNK_SIZE,file)) > 0)<br>
> {<br>
> int offset = 0;<br>
> while (((sent =<br>
> nice_agent_send(agent,stream_id,NICE_COMPONENT_TYPE_RTP,nbytes,fi<br>
> le_chunk+offset)) > 0) || (sent == -1 && errno == EINTR) ) {<br>
> if (sent > 0) {<br>
> printf("SENT FILE: chunk size: %zu send result:<br>
> %d \n",nbytes,sent);<br>
> offset += sent;<br>
> nbytes -= sent;<br>
> }<br>
> }<br>
> }<br>
> return 0;<br>
> }<br>
><br>
> And the callback to receive:<br>
><br>
> void<br>
> cb_nice_recv (NiceAgent * agent, guint stream_id, guint component_id,<br>
> guint len, gchar * buf, gpointer user_data)<br>
> {<br>
> FILE *file_received=fopen("testFile-received.txt", "ab");<br>
><br>
> if(file_received){<br>
> int writen = fwrite(buf,sizeof(char),len,file_received);<br>
> printf("RECEIVED FILE: buf size: %d , writen size: %d\n\n",len,writen);<br>
> }<br>
> else{ perror("ERROR OPENING FILE\n"); }<br>
> }<br>
><br>
> It sends some chunks and then starts to fail on send.<br>
><br>
> Problably I should use the "reliable-transport-writable" signal, to wait before<br>
> trying to send a new chunk, but then, the signal must be handled by a different<br>
> callback, am I write? Or can I "wait" for the signal on the same send_file function?<br>
<br>
</div></div>The read callback is fine, although you should remember to fclose the file...<br>
As for the sending, you're not waiting for it to be writable. I don't think that<br>
'errno' has any meaning either in the world of libnice...<br>
<br>
The way you should do it is to send data using a callback function that you hook<br>
into the reliable-transport-writable signal. That signal will be sent when you<br>
first connect (so you don't need to listen for state changes actually), and then<br>
it will only be sent if the nice_agent_send returns less bytes than you tried to<br>
send or if it returns -1.<br>
Don't forget that if you call nice_agent_send, and it returns the right number<br>
of bytes sent, then the writable signal will not be emitted.. the emission of<br>
the signal is only enabled IF the last operation of the nice_agent_send was that<br>
it couldn't send the full buffer you gave it..<br>
<br>
So here's a quick pseudocode to illustrate how you should do it :<br>
void<br>
writable_cb (NiceAgent *agent, guint sid, guint cid, gpointer data)<br>
{<br>
FILE *file = data;<br>
<div class="im"> char *file_chunk = malloc(CHUNK_SIZE);<br>
size_t nbytes = 0;<br>
int sent=0;<br>
<br>
</div> while ( (nbytes = fread(file_chunk, sizeof(char), CHUNK_SIZE, file)) > 0)<br>
{<br>
int offset = 0;<br>
sent = nice_agent_send(agent,stream_id, NICE_COMPONENT_TYPE_RTP,<br>
nbytes,file_chunk);<br>
if (sent < nbytes) {<br>
/* If return value is -1 it means nothing was sent */<br>
if (sent == -1)<br>
sent = 0;<br>
/* seek back to the last byte that was actually sent, so it gets<br>
read on the next pass */<br>
fseek (file, nbytes - seek, SEEK_CURRENT);<br>
<br>
/* break and exit the function, wait for the next signal callback<br>
to continue sending the rest of the data */<br>
break;<br>
}<br>
}<br>
}<br>
<br>
main() {<br>
<br>
FILE* fd = fopen("some_file.txt", "rb");<br>
<br>
agent = nice_agent_reliable_new();<br>
g_signal_connect(agent, "reliable-transport-writable", writable_cb, fd);<br>
<br>
}<br>
<br>
<br>
This should be enough to give you an idea on what needs to be done.<br>
Hope it helps!<br>
<br>
Youness.<br>
<div class="im"><br>
><br>
> Thank you for the helpful information you are sharing.<br>
><br>
> Cheers,<br>
> Tiago Sá<br>
><br>
><br>
> On Mon, Dec 12, 2011 at 11:39 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>
> On 12/12/2011 06:20 AM, Tiago Sá wrote:<br>
> > Hi again Youness,<br>
> Hi again Tiago,<br>
><br>
> ><br>
> > my application is progressing in small steps.<br>
> > We chose to use XMPP for the communication. We are using libstrophe, it lacks<br>
> > some documentation, but was enough for our needs.<br>
> > We implemented a naif handshake, life the one you mentioned above, by<br>
> exchanging<br>
> > some xmpp message stanzas.<br>
><br>
> Cool, you may want to look at the jingle XEP to see how candidates are being<br>
> transferred in a VoIP call.<br>
><br>
> ><br>
> > This application will be part of a research project involving the grid,<br>
> where we<br>
> > need private hosts (called agents) to be able to communicate someway. We will<br>
> > implement that (inter-agent) communication protocol later, right now we are<br>
> > concerned with the NAT traversal thing, and it seems to be working fine :)<br>
> ><br>
> > Now, I would like to ask you a final question:<br>
> > Right now we are able to send strings using "nice_agent_send". We would<br>
> like to<br>
> > establish a socket between the hosts and use other common primitives to<br>
> code our<br>
> > application.<br>
> > Maybe the best possibility would be to create some kind of pipe from an<br>
> > "external" application using local ports (something<br>
> > like <a href="http://code.google.com/p/gnat/" target="_blank">http://code.google.com/p/gnat/</a>)<br>
> > Or, in a simpler way, just pipe stdin/stdout from another app, slice that data<br>
> > and send it using libnice send primitive?<br>
> ><br>
> > Have you ever tried something like this?<br>
> I have not tried something like that, but it shouldn't be too hard in my<br>
> opinion. You could just create a local daemon that connects to the XMPP server,<br>
> and when it gets a new local connection, it sends candidates and acts as a proxy<br>
</div></div>> between the <a href="http://127.0.0.1:12345" target="_blank">127.0.0.1:12345</a> <<a href="http://127.0.0.1:12345" target="_blank">http://127.0.0.1:12345</a>> socket and the remote<br>
<div class="im HOEnZb">> socket with the<br>
> nice_agent_send and the recv callback.<br>
> Would be nice if that code gets shared if you ever get to do it. But I don't see<br>
> anything that would prevent it from working.<br>
> Good luck!<br>
> ><br>
> > Thank you very much for your help.<br>
> ><br>
> > Cheers,<br>
> > Tiago<br>
> ><br>
> ><br>
> ><br>
> ><br>
> > On Mon, Nov 28, 2011 at 12:46 PM, Youness Alaoui<br>
> <<a href="mailto:youness.alaoui@collabora.co.uk">youness.alaoui@collabora.co.uk</a> <mailto:<a href="mailto:youness.alaoui@collabora.co.uk">youness.alaoui@collabora.co.uk</a>><br>
</div><div class="im HOEnZb">> > <mailto:<a href="mailto:youness.alaoui@collabora.co.uk">youness.alaoui@collabora.co.uk</a><br>
> <mailto:<a href="mailto:youness.alaoui@collabora.co.uk">youness.alaoui@collabora.co.uk</a>>>> wrote:<br>
> ><br>
</div><div class="HOEnZb"><div class="h5">> > On 11/23/2011 01:14 PM, Tiago Sá wrote:<br>
> > > Hi Youness,<br>
> > ><br>
> > > thank you for your suggestions.<br>
> > > You'r right, the STUN/TURN server I was using had a connection limit. I<br>
> > > installed the <a href="http://turnserver.org" target="_blank">turnserver.org</a> <<a href="http://turnserver.org" target="_blank">http://turnserver.org</a>><br>
> <<a href="http://turnserver.org" target="_blank">http://turnserver.org</a>><br>
> > <<a href="http://turnserver.org" target="_blank">http://turnserver.org</a>> one in a public addressed<br>
> > > machine.<br>
> > > I also changed the way how I was writing the candidates, setting those<br>
> > pointers<br>
> > > to NULL.<br>
> > > ICE seems to be working properly now! :)<br>
> > Glad it worked :)<br>
> ><br>
> > ><br>
> > > I have a question:<br>
> > > According to the example in<br>
> <a href="http://nice.freedesktop.org/libnice/NiceAgent.html" target="_blank">http://nice.freedesktop.org/libnice/NiceAgent.html</a><br>
> > > we should be able to start sending messages after the signal<br>
> new-selected-pair<br>
> > > is fired. However, I tried it but no success:<br>
> > > void<br>
> > > cb_new_selected_pair (void)<br>
> > > {<br>
> > > printf ("cb_new_selected_pair\n");<br>
> > > nice_agent_send(agent, stream_id, NICE_COMPONENT_TYPE_RTP,<br>
> > strlen("Ola"),"Ola");<br>
> > > }<br>
> > ><br>
> > > That first message is never received. However, after "a while" I try<br>
> to send<br>
> > > again and it works. Do I have to wait for the other agent to be ready to<br>
> > receive?<br>
> > Humm.. that might not have been entirely true.. technically if there is a<br>
> > selected pair, then it should work, unless you are ready locally, but<br>
> the remote<br>
> > isn't ready to receive yet. technically you should wait for the state<br>
> to go to<br>
> > READY... and not care about the selected pair.. the docs might be<br>
> wrong there,<br>
> > but it's been a while and I'm not entirely sure of the use case that<br>
> would make<br>
> > it fail (but in every other project, we use the READY state as an<br>
> indication<br>
> > that we're ready to send).<br>
> ><br>
> > ><br>
> > > Well, this is a checkpoint for me, but I must ask for another<br>
> suggestion now.<br>
> > > I need to improve the way how the communication between agents is made<br>
> > > (exchanging candidates/credentials, initiating p2p connections, etc...)<br>
> > > As I read in this<br>
> > > thread<br>
> <a href="http://lists.freedesktop.org/archives/nice/2010-August/000330.html" target="_blank">http://lists.freedesktop.org/archives/nice/2010-August/000330.html</a><br>
> > , you<br>
> > > wrote:<br>
> > > "well, the serialization, if I understand what you mean, is how you<br>
> send the<br>
> > > candidates to the other side, right ? In that case, that's not part<br>
> of the ICE<br>
> > > methodology.. you can 'serialize' the candidates/user/pass any way<br>
> you want..<br>
> > > one method is to put it in the SDP of a SIP invite. You can also<br>
> send it as an<br>
> > > XML using Jingle's XEP over an XMPP connection.. it really all<br>
> depends on what<br>
> > > protocol is being used to connect to the server (SIP, XMPP, custom,<br>
> other...).<br>
> > > I'll let you decide on the best way to do that."<br>
> > Thanks for searching in the archives :)<br>
> ><br>
> > ><br>
> > > After doing some research, I feel a bit scared. That is a completely<br>
> new world<br>
> > > for me. Could you please point the "simplest and most feasible"<br>
> solution for<br>
> > > this problem? Should I choose SIP or XMPP?<br>
> > > libjingle, for example, presents a huge API...<br>
> > > Do you know any simple client, possibly allowing me to connect to an<br>
> existing<br>
> > > infrastructure (such as Google Talk), I could use for this trivial<br>
> information<br>
> > > exchange?<br>
> ><br>
> > Humm.. yes, libjingle is a big pile of **** :) my suggestion is to<br>
> never use it!<br>
> > The real question here is what do you need libnice for? what will the<br>
> clients be<br>
> > ? if it's for a game or some custom application and that you can<br>
> control the<br>
> > server and the client, then you can setup something custom. If you<br>
> want to have<br>
> > a list of contacts in your application and the user can just select<br>
> one and it<br>
> > will know what to do, then using XMPP might be the best solution. It<br>
> really all<br>
> > depends on your needs and capabilities.. you can decide all about it,<br>
> but here's<br>
> > a simple example if you want :<br>
> > client sending to server is : ---><br>
> > client receiving from server is : <-----<br>
> > Comments are preceded with #<br>
> > ----> HELLO<br>
> > <---- HELLO 12345 # Where 12345 would be a random id that gets<br>
> assigned to you<br>
> > ----> 54321 BEGIN ICE # first number being the 'random id' of the<br>
> destination<br>
> > ----> 54321 ICE-CREDENTIALS <the_username> <the_password><br>
> > ----> 54321 CANDIDATE 1 UDP 192.168.1.100 43132 host<br>
> > ----> 54321 CANDIDATE 2 UDP 1.2.3.4 52133 srv-reflx<br>
> > ----> 54321 ICE DONE # To say you're done, you can send it to the peer<br>
> > <---- 54321 ICE REPLY<br>
> > <---- 54321 ICE-CREDENTIALS foo bar # the remote's credentials<br>
> > <---- 54321 CANDIDATE 1 UDP 192.168.1.200 54521 host<br>
> > <---- 54321 CANDIDATE 2 UDP 1.2.4.1 9614 srv-reflx<br>
> > <---- 54321 CANDIDATE 3 UDP <a href="tel:4.3.2.1%2032957" value="+351432132957">4.3.2.1 32957</a> <tel:4.3.2.1%2032957><br>
> <tel:4.3.2.1%2032957> relay-reflx<br>
> > <---- 54321 ICE DONE<br>
> > [...]<br>
> > ----> 54321 ICE DESTROY<br>
> ><br>
> > And your server just maps sockets with those random ids, and relays<br>
> the data<br>
> > from one socket to another. And you parse the received input and build<br>
> your<br>
> > candidates...<br>
> > So this is a very simple, but of course inefficient, you get a random id<br>
> > everytime, it's hard to improve the protocol, etc... so using XMPP<br>
> would be<br>
> > better, but if you really don't need that much, then this might be the<br>
> solution<br>
> > you want.. like I said, it really depends on what you need it for.<br>
> > As for XMPP, you can look at the 'wocky' library<br>
> > (<a href="http://cgit.freedesktop.org/wocky/" target="_blank">http://cgit.freedesktop.org/wocky/</a>)<br>
> ><br>
> ><br>
> > ><br>
> > > Thank you for your help.<br>
> > You're welcome :)<br>
> ><br>
> > ><br>
> > > Regards,<br>
> > > Tiago Sá<br>
> > ><br>
> > ><br>
> > ><br>
> > > On Thu, Nov 17, 2011 at 9:42 PM, Youness Alaoui<br>
> > <<a href="mailto:youness.alaoui@collabora.co.uk">youness.alaoui@collabora.co.uk</a><br>
> <mailto:<a href="mailto:youness.alaoui@collabora.co.uk">youness.alaoui@collabora.co.uk</a>><br>
> <mailto:<a href="mailto:youness.alaoui@collabora.co.uk">youness.alaoui@collabora.co.uk</a> <mailto:<a href="mailto:youness.alaoui@collabora.co.uk">youness.alaoui@collabora.co.uk</a>>><br>
</div></div><div class="HOEnZb"><div class="h5">> > > <mailto:<a href="mailto:youness.alaoui@collabora.co.uk">youness.alaoui@collabora.co.uk</a><br>
> <mailto:<a href="mailto:youness.alaoui@collabora.co.uk">youness.alaoui@collabora.co.uk</a>><br>
> > <mailto:<a href="mailto:youness.alaoui@collabora.co.uk">youness.alaoui@collabora.co.uk</a><br>
> <mailto:<a href="mailto:youness.alaoui@collabora.co.uk">youness.alaoui@collabora.co.uk</a>>>>> wrote:<br>
> > ><br>
> > > On 11/16/2011 08:30 PM, Tiago Sá wrote:<br>
> > > > Hi again Youness,<br>
> > > > thanks a lot for your help.<br>
> > > > I believe I solved the problems you pointed before.<br>
> > > > I am using a dumb method to exchange candidates. I write them to<br>
> > file and<br>
> > > > exchange them using a ftp server (I will improve it later).<br>
> > > ><br>
> > > > So, the way I run it is:<br>
> > > > (HostA) ./client l<br>
> > > > (HostB) ./client r<br>
> > > > //local candidates are gathered and written to file<br>
> > > > (HostA) put leftCands.bin on FTP and get rightCands.bin<br>
> > > > (HostB) put rightCands.bin on FTP and get leftCands.bin<br>
> > > > //read local credentials and write them on the remote host<br>
> > > ><br>
> > > > I am using a relay server, that should work as a last resort. But<br>
> > during the<br>
> > > > local candidate gathering, sometimes it gets a relayed candidate,<br>
> > but most of<br>
> > > > the times it doesn't. Can it be related with timeouts?<br>
> > > It's possible the timeouts are affecting it, but I doubt it, usually<br>
> > the RTT<br>
> > > would be 200ms, but if you don't get a response from the relay<br>
> or the stun<br>
> > > server, it will retry 4 times until it times out after about 3<br>
> seconds.<br>
> > > It's possible though that the server has a limit on the number of<br>
> > allocations<br>
> > > you can create (probably 5) and if you are testing your app and it<br>
> > creates 2<br>
> > > allocations each time (one for each side), then it's possible the<br>
> > server starts<br>
> > > rejecting your allocation requests (each time you want to use<br>
> TURN, it<br>
> > will ask<br>
> > > the server to allocate a port for you for that specific<br>
> connection, so<br>
> > you have<br>
> > > the same settings but one port for each stream/component).<br>
> > > If that's the case, maybe that's why it sometimes works (when the<br>
> > allocation<br>
> > > times out from the server). libnice should technically<br>
> deallocate when the<br>
> > > stream is destroyed, so maybe catch your Ctrl-C and do an unref<br>
> on the<br>
> > agent<br>
> > > before returning from the main.<br>
> > ><br>
> > > ><br>
> > > > Either way, it can never get a pair a establish a connection. :(<br>
> > > > I don't have a clue why this happens..<br>
> > ><br>
> > > A log + wireshark dump might be helpful in this case. You can enable<br>
> > logging<br>
> > > with :<br>
> > > export NICE_DEBUG=all<br>
> > ><br>
> > ><br>
> > > ><br>
> > > > Can you please have a look?<br>
> > > The code looks sane enough.. apart from the obvious method of<br>
> exchanging<br>
> > > candidates which isn't "optimal". One thing I noticed though,<br>
> you just<br>
> > fwrite<br>
> > > the whole structure, but note that there are pointers in the<br>
> structure<br>
> > that will<br>
> > > be written as is to the file, and not their content. I'm thinking of<br>
> > > username+password (but those should be NULL if you use the RFC5245<br>
> > compatibility<br>
> > > mode) but mostly the turn structure (which is just for local<br>
> > candidates and<br>
> > > wouldn't be used anyways for remote ones, but it's best to set it to<br>
> > NULL to<br>
> > > avoid possible crashes).<br>
> > ><br>
> > > ><br>
> > > > Cheers,<br>
> > > > Tiago<br>
> > > ><br>
> > > ><br>
> > > > On Fri, Nov 4, 2011 at 2:03 PM, Youness Alaoui<br>
> > > <<a href="mailto:youness.alaoui@collabora.co.uk">youness.alaoui@collabora.co.uk</a><br>
> <mailto:<a href="mailto:youness.alaoui@collabora.co.uk">youness.alaoui@collabora.co.uk</a>><br>
> > <mailto:<a href="mailto:youness.alaoui@collabora.co.uk">youness.alaoui@collabora.co.uk</a><br>
> <mailto:<a href="mailto:youness.alaoui@collabora.co.uk">youness.alaoui@collabora.co.uk</a>>><br>
> > <mailto:<a href="mailto:youness.alaoui@collabora.co.uk">youness.alaoui@collabora.co.uk</a><br>
> <mailto:<a href="mailto:youness.alaoui@collabora.co.uk">youness.alaoui@collabora.co.uk</a>><br>
> <mailto:<a href="mailto:youness.alaoui@collabora.co.uk">youness.alaoui@collabora.co.uk</a> <mailto:<a href="mailto:youness.alaoui@collabora.co.uk">youness.alaoui@collabora.co.uk</a>>>><br>
</div></div><div class="HOEnZb"><div class="h5">> > > > <mailto:<a href="mailto:youness.alaoui@collabora.co.uk">youness.alaoui@collabora.co.uk</a><br>
> <mailto:<a href="mailto:youness.alaoui@collabora.co.uk">youness.alaoui@collabora.co.uk</a>><br>
> > <mailto:<a href="mailto:youness.alaoui@collabora.co.uk">youness.alaoui@collabora.co.uk</a><br>
> <mailto:<a href="mailto:youness.alaoui@collabora.co.uk">youness.alaoui@collabora.co.uk</a>>><br>
> > > <mailto:<a href="mailto:youness.alaoui@collabora.co.uk">youness.alaoui@collabora.co.uk</a><br>
> <mailto:<a href="mailto:youness.alaoui@collabora.co.uk">youness.alaoui@collabora.co.uk</a>><br>
> > <mailto:<a href="mailto:youness.alaoui@collabora.co.uk">youness.alaoui@collabora.co.uk</a><br>
> <mailto:<a href="mailto:youness.alaoui@collabora.co.uk">youness.alaoui@collabora.co.uk</a>>>>>> wrote:<br>
> > > ><br>
> > > > Hi again Tiago,<br>
> > > ><br>
> > > > For the remote candidates, you will need a third party<br>
> server to<br>
> > > exchange that<br>
> > > > information, usually the candidates would be sent over SIP or<br>
> > XMPP for<br>
> > > example.<br>
> > > > ICE cannot work if you don't have a third party server with<br>
> > which you can<br>
> > > > reliably exchange candidates. For testing purposes you<br>
> could have it<br>
> > > print the<br>
> > > > candidates to stdout, and you could copy/paste that into stdin<br>
> > of the<br>
> > > other<br>
> > > > instance and have it parse the input.. or you could hardcode a<br>
> > port to<br>
> > > connect<br>
> > > > to and do the candidate exchange.. there's no easy way of<br>
> doing that<br>
> > > though.<br>
> > > > You cannot hardcode the candidates because the port used<br>
> will be<br>
> > random<br>
> > > > everytime, also, you will need to exchange the randomly<br>
> generated<br>
> > > > username/password (nice_agent_get_local_credentials +<br>
> > > > nice_agent_set_remote_credentials) to make the connectivity<br>
> > 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<br>
> being<br>
> > > 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<br>
> as the<br>
> > local ones<br>
> > > > 4 - In your print_candidate_info, you may also want to<br>
> print the<br>
> > port<br>
> > > used.<br>
> > > ><br>
> > > > I hope this helps, let me know if you have further questions.<br>
> > > ><br>
> > > > Youness.<br>
> > > ><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<br>
> on the<br>
> > first<br>
> > > link you<br>
> > > > > pointed before.<br>
> > > > > Thanks for the tips you gave me. I have a couple of<br>
> questions<br>
> > though, if<br>
> > > > you can<br>
> > > > > help me.<br>
> > > > ><br>
> > > > > I need to find a way to get the remote candidates passed<br>
> from<br>
> > a peer to<br>
> > > > another.<br>
> > > > > Can you point an easy way to do that?<br>
> > > > > Could I hardcode the remote candidates list, for testing<br>
> purposes?<br>
> > > > ><br>
> > > > > Right now, I only get two local candidates (HOST and<br>
> > SERVER_REFLEXIVE).<br>
> > > > > I am trying to use the numb TURN server, shouldn't I get<br>
> a RELAYED<br>
> > > > candidate too?<br>
> > > > ><br>
> > > > > I am attaching the code. Can you please have a look at the<br>
> > code and<br>
> > > check<br>
> > > > 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<br>
> > > > <<a href="mailto:youness.alaoui@collabora.co.uk">youness.alaoui@collabora.co.uk</a><br>
> <mailto:<a href="mailto:youness.alaoui@collabora.co.uk">youness.alaoui@collabora.co.uk</a>><br>
> > <mailto:<a href="mailto:youness.alaoui@collabora.co.uk">youness.alaoui@collabora.co.uk</a><br>
> <mailto:<a href="mailto:youness.alaoui@collabora.co.uk">youness.alaoui@collabora.co.uk</a>>><br>
> > > <mailto:<a href="mailto:youness.alaoui@collabora.co.uk">youness.alaoui@collabora.co.uk</a><br>
> <mailto:<a href="mailto:youness.alaoui@collabora.co.uk">youness.alaoui@collabora.co.uk</a>><br>
> > <mailto:<a href="mailto:youness.alaoui@collabora.co.uk">youness.alaoui@collabora.co.uk</a><br>
> <mailto:<a href="mailto:youness.alaoui@collabora.co.uk">youness.alaoui@collabora.co.uk</a>>>><br>
> > > <mailto:<a href="mailto:youness.alaoui@collabora.co.uk">youness.alaoui@collabora.co.uk</a><br>
> <mailto:<a href="mailto:youness.alaoui@collabora.co.uk">youness.alaoui@collabora.co.uk</a>><br>
> > <mailto:<a href="mailto:youness.alaoui@collabora.co.uk">youness.alaoui@collabora.co.uk</a><br>
> <mailto:<a href="mailto:youness.alaoui@collabora.co.uk">youness.alaoui@collabora.co.uk</a>>><br>
> > <mailto:<a href="mailto:youness.alaoui@collabora.co.uk">youness.alaoui@collabora.co.uk</a><br>
> <mailto:<a href="mailto:youness.alaoui@collabora.co.uk">youness.alaoui@collabora.co.uk</a>><br>
> <mailto:<a href="mailto:youness.alaoui@collabora.co.uk">youness.alaoui@collabora.co.uk</a><br>
> <mailto:<a href="mailto:youness.alaoui@collabora.co.uk">youness.alaoui@collabora.co.uk</a>>>>><br>
> > > > > <mailto:<a href="mailto:youness.alaoui@collabora.co.uk">youness.alaoui@collabora.co.uk</a><br>
> <mailto:<a href="mailto:youness.alaoui@collabora.co.uk">youness.alaoui@collabora.co.uk</a>><br>
> > <mailto:<a href="mailto:youness.alaoui@collabora.co.uk">youness.alaoui@collabora.co.uk</a><br>
> <mailto:<a href="mailto:youness.alaoui@collabora.co.uk">youness.alaoui@collabora.co.uk</a>>><br>
> > > <mailto:<a href="mailto:youness.alaoui@collabora.co.uk">youness.alaoui@collabora.co.uk</a><br>
> <mailto:<a href="mailto:youness.alaoui@collabora.co.uk">youness.alaoui@collabora.co.uk</a>><br>
> > <mailto:<a href="mailto:youness.alaoui@collabora.co.uk">youness.alaoui@collabora.co.uk</a><br>
> <mailto:<a href="mailto:youness.alaoui@collabora.co.uk">youness.alaoui@collabora.co.uk</a>>>><br>
> > > > <mailto:<a href="mailto:youness.alaoui@collabora.co.uk">youness.alaoui@collabora.co.uk</a><br>
> <mailto:<a href="mailto:youness.alaoui@collabora.co.uk">youness.alaoui@collabora.co.uk</a>><br>
> > <mailto:<a href="mailto:youness.alaoui@collabora.co.uk">youness.alaoui@collabora.co.uk</a><br>
> <mailto:<a href="mailto:youness.alaoui@collabora.co.uk">youness.alaoui@collabora.co.uk</a>>><br>
> > > <mailto:<a href="mailto:youness.alaoui@collabora.co.uk">youness.alaoui@collabora.co.uk</a><br>
> <mailto:<a href="mailto:youness.alaoui@collabora.co.uk">youness.alaoui@collabora.co.uk</a>><br>
> > <mailto:<a href="mailto:youness.alaoui@collabora.co.uk">youness.alaoui@collabora.co.uk</a><br>
> <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<br>
> only<br>
> > > solution is<br>
> > > > pretty<br>
> > > > > much to use the ICE specification and that's not easy to<br>
> > > implement, so<br>
> > > > that's<br>
> > > > > why you'd need to use libnice.<br>
> > > > ><br>
> > > > > For an example, you can have a look at the unit<br>
> tests, like<br>
> > > > > tests/test-fullmode.c for example, although that<br>
> does a lot of<br>
> > > stuff.<br>
> > > > You can<br>
> > > > > see a quick example in the documentation for<br>
> 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<br>
> mailing list<br>
> > > > archives, some<br>
> > > > > people posted their example code where they were having<br>
> > > problems. For<br>
> > > > example, a<br>
> > > > > very simple example can be seen here :<br>
> > > > ><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<br>
> the whole<br>
> > > thread<br>
> > > > because<br>
> > > > > that example had a bug that I explained how to fix<br>
> in the<br>
> > following<br>
> > > > emails.<br>
> > > > > Same for this thread :<br>
> > > > ><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<br>
> Portugal<br>
> > > and this<br>
> > > > is my<br>
> > > > > first<br>
> > > > > > mail to this list.<br>
> > > > > > I have a NAT traversal problem to solve and I have<br>
> been<br>
> > > looking for<br>
> > > > a solution<br>
> > > > > > during the last weeks, which, as I found out, is<br>
> not so<br>
> > > trivial as I<br>
> > > > > thought before.<br>
> > > > > > As stated on the libnice homepage, libnice seems to be<br>
> > what I am<br>
> > > > looking for:<br>
> > > > > ><br>
> > > > > > "ICE is useful for applications that want to<br>
> establish<br>
> > > peer-to-peer<br>
> > > > > UDP data<br>
> > > > > > streams. It automates the process of<br>
> traversing NATs and<br>
> > > > provides security<br>
> > > > > > against some attacks. It also allows<br>
> applications to<br>
> > > create reliable<br>
> > > > > streams<br>
> > > > > > using a TCP over UDP layer."<br>
> > > > > ><br>
> > > > > ><br>
> > > > > > I have been looking for the provided documentation<br>
> and I am<br>
> > > feeling kind<br>
> > > > > of lost.<br>
> > > > > > Is there any example application or tutorial to<br>
> get started?<br>
> > > > > > Could you please share a basic application of this<br>
> kind or<br>
> > > 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>
> > > > > > <a href="mailto:Nice@lists.freedesktop.org">Nice@lists.freedesktop.org</a><br>
> <mailto:<a href="mailto:Nice@lists.freedesktop.org">Nice@lists.freedesktop.org</a>><br>
> > <mailto:<a href="mailto:Nice@lists.freedesktop.org">Nice@lists.freedesktop.org</a><br>
> <mailto:<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>
> <mailto:<a href="mailto:Nice@lists.freedesktop.org">Nice@lists.freedesktop.org</a>><br>
> > <mailto:<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>
> > > <mailto:<a href="mailto:Nice@lists.freedesktop.org">Nice@lists.freedesktop.org</a><br>
> <mailto:<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>
> <mailto:<a href="mailto:Nice@lists.freedesktop.org">Nice@lists.freedesktop.org</a>>><br>
> > <mailto:<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>
> <mailto:<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>
> > > > <mailto:<a href="mailto:Nice@lists.freedesktop.org">Nice@lists.freedesktop.org</a><br>
> <mailto:<a href="mailto:Nice@lists.freedesktop.org">Nice@lists.freedesktop.org</a>><br>
> > <mailto:<a href="mailto:Nice@lists.freedesktop.org">Nice@lists.freedesktop.org</a><br>
> <mailto:<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>
> <mailto:<a href="mailto:Nice@lists.freedesktop.org">Nice@lists.freedesktop.org</a>><br>
> > <mailto:<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>
> > > <mailto:<a href="mailto:Nice@lists.freedesktop.org">Nice@lists.freedesktop.org</a><br>
> <mailto:<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>
> <mailto:<a href="mailto:Nice@lists.freedesktop.org">Nice@lists.freedesktop.org</a>>><br>
> > <mailto:<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>
> <mailto:<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>
> > > > > > <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>
> > > > > <a href="mailto:Nice@lists.freedesktop.org">Nice@lists.freedesktop.org</a><br>
> <mailto:<a href="mailto:Nice@lists.freedesktop.org">Nice@lists.freedesktop.org</a>><br>
> > <mailto:<a href="mailto:Nice@lists.freedesktop.org">Nice@lists.freedesktop.org</a><br>
> <mailto:<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>
> <mailto:<a href="mailto:Nice@lists.freedesktop.org">Nice@lists.freedesktop.org</a>><br>
> > <mailto:<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>
> > > <mailto:<a href="mailto:Nice@lists.freedesktop.org">Nice@lists.freedesktop.org</a><br>
> <mailto:<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>
> <mailto:<a href="mailto:Nice@lists.freedesktop.org">Nice@lists.freedesktop.org</a>>><br>
> > <mailto:<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>
> <mailto:<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>
> > > > <mailto:<a href="mailto:Nice@lists.freedesktop.org">Nice@lists.freedesktop.org</a><br>
> <mailto:<a href="mailto:Nice@lists.freedesktop.org">Nice@lists.freedesktop.org</a>><br>
> > <mailto:<a href="mailto:Nice@lists.freedesktop.org">Nice@lists.freedesktop.org</a><br>
> <mailto:<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>
> <mailto:<a href="mailto:Nice@lists.freedesktop.org">Nice@lists.freedesktop.org</a>><br>
> > <mailto:<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>
> > > <mailto:<a href="mailto:Nice@lists.freedesktop.org">Nice@lists.freedesktop.org</a><br>
> <mailto:<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>
> <mailto:<a href="mailto:Nice@lists.freedesktop.org">Nice@lists.freedesktop.org</a>>><br>
> > <mailto:<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>
> <mailto:<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>
> > > > > <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>
> > > > > <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>
> <<a href="http://www.tiagosa.com" target="_blank">http://www.tiagosa.com</a>><br>
> > <<a href="http://www.tiagosa.com" target="_blank">http://www.tiagosa.com</a>> <<a href="http://www.tiagosa.com" target="_blank">http://www.tiagosa.com</a>><br>
> > > <<a href="http://www.tiagosa.com" target="_blank">http://www.tiagosa.com</a>><br>
> > > > ><br>
> > > ><br>
> > > ><br>
> > > ><br>
> > > ><br>
> > > ><br>
> > > > --<br>
> > > > Tiago Sá<br>
> > > > Universidade do Minho, Braga - Portugal<br>
> > > > <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>
> <<a href="http://www.tiagosa.com" target="_blank">http://www.tiagosa.com</a>> <<a href="http://www.tiagosa.com" target="_blank">http://www.tiagosa.com</a>><br>
> > <<a href="http://www.tiagosa.com" target="_blank">http://www.tiagosa.com</a>><br>
> > > ><br>
> > ><br>
> > ><br>
> > ><br>
> > ><br>
> > ><br>
> > > --<br>
> > > Tiago Sá<br>
> > > Universidade do Minho, Braga - Portugal<br>
> > > <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>> <<a href="http://www.tiagosa.com" target="_blank">http://www.tiagosa.com</a>><br>
> <<a href="http://www.tiagosa.com" target="_blank">http://www.tiagosa.com</a>><br>
> > ><br>
> ><br>
> ><br>
> ><br>
> ><br>
> ><br>
> > --<br>
> > Tiago Sá<br>
> > Universidade do Minho, Braga - Portugal<br>
> > <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>> <<a href="http://www.tiagosa.com" target="_blank">http://www.tiagosa.com</a>><br>
> ><br>
><br>
><br>
><br>
><br>
><br>
> --<br>
> Tiago Sá<br>
> Universidade do Minho, Braga - Portugal<br>
> <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>
</div></div></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>