Page 1 of 1

UDP sending not checked.

Posted: 09 Nov 2004 14:26
by Frederic F
While making some streaming tests on a linux (SuSe) PC over an Ethernet LAN, I observed that a lot of packets were lost. But after using tcpdump, I managed to see that, while indeed some packets were lost during transmission, other packets were not even sent !

Looking at the code (specifically modules/access_output/udp.c), I could see that this line (line 524 in version 0.8.0-test2):

Code: Select all

send( p_thread->i_handle, p_pk->p_buffer, p_pk->i_buffer, 0 );
was not checked against possible errors.

Then I replaced the previous line with this block of code:

Code: Select all

{ #define NBTRYMAX 10 int nbsent=-1; int nbtry=0; while (nbsent==-1 && nbtry++ < NBTRYMAX) { nbsent = send( p_thread->i_handle, p_pk->p_buffer, p_pk->i_buffer, 0 ); } if (nbtry > 1) { if (nbsent==-1) { msg_Dbg( p_thread, "Error : One packet could not be sent after %d attempts.", NBTRYMAX); } else { msg_Dbg( p_thread, "Warning : packet sent after %d attempts", nbtry); } } }
which tries several times to send the packet before giving up.

Posted: 10 Nov 2004 11:25
by Frederic F
I filed it in bugzilla, bug-id 1918

Posted: 16 Nov 2004 17:44
by fen
Well it seems to be a bit weird. We open the socket in blocking mode, so
send should block until it can send the packet.

Could you report the value of errno in case of failure as well as strerror(errno) ?

Posted: 17 Nov 2004 20:49
by Frederic F
Perhaps it is specific to SuSe ? Or even to the PC used in the test ? I really don't know. I also tried on WindowsXP (on a different PC) and the problem did not occur there.

errno is set to 111 (ECONNREFUSED "Connection refused").