[Nice] Sending data but not receiving the last part.

Federico Kouyoumdjian fedekp at autistici.org
Fri Sep 14 14:49:17 PDT 2012


>> I'm having problems with the send of a file, I get almost all the file (~185KB),
>> but at the end I don receive the last part,
>> I'm using a reliable agent to transfer the file, the sender send all the pieces,
>> but the receiver don't get the last part, can it be because I have some info in
>> some buffer in the agent that I need to flush (in this case, how I do the flush)
>> or may be because other issue?
>
> Make sure the nice_agent_send doesn't return a length inferior to the requested
> size (in which case, you have to wait for the writable signal before sending the
> last part).
> As for flushing, no, there is no way of doing a flush. Even if there was an API
> for it, it wouldn't work, if you flush and you unref right away, there is no way
> to ensure the flush happened because it's over UDP, and if the agent is
> destroyed, it can't syn/ack/retransmit/etc..
>>
>> We are doing an unref ("g_object_unref(data->agent);") of the agent in the
>> sender, but the agent in the receiver side don't change state,
>> nor NICE_COMPONENT_STATE_FAILED or NICE_COMPONENT_STATE_DISCONNECTED.
>
> Yeah, if the unref destroys the agent, then it might not have had time to flush
> (it does try to flush, but the socket might not have time to do send the data
> before it gets closed).
> As for the other side not going into FAILED state, it's because it will
> periodically send connchecks to ensure it's still open and you'd have to wait
> about 30 seconds before it detects that the connection dropped.
>
> My suggestion for your problem is to simply put a timer after completion before
> closing the agent.. like, unref the agent 30 seconds after sending/receiving the
> file...

Thanks for the response. I've been trying different approaches but 
instead of getting better now the nice transmission stops at the 
beginning. Now I know that I have to wait for the writable callback to 
try to send the remaining data again. But I don't know where to send the 
remaining data again. Is the writeable callback only supposed to change 
the value of a flag "writable" or I have to do the send inside the 
writable callback? If the writable callback is fired immediately after 
the nice_agent_send finishes execution how do I know inside the callback 
which was the return of the nice_agent_send? Is there an example that I 
can check online in the web because the only one I found was this 
material tp://nice.freedesktop.org/libnice/NiceAgent.html 
http://nice.freedesktop.org/libnice/NiceAgent.html#nice-agent-send 
http://nice.freedesktop.org/libnice/NiceAgent.html#NiceAgent-reliable-transport-writable 
but I still can't understand exactly how it works.

Thanks in advance.


More information about the nice mailing list