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

Youness Alaoui youness.alaoui at collabora.co.uk
Wed Sep 12 11:50:09 PDT 2012

On 09/11/2012 10:09 PM, Andrés Suero wrote:
> Hello,
> 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,

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

> Thanks in advance,
> Andrés and Federico
> _______________________________________________
> nice mailing list
> nice at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/nice

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 259 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/nice/attachments/20120912/2b5e3a87/attachment.pgp>

More information about the nice mailing list