UDP sending not checked.
Posted: 09 Nov 2004 14:26
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):
was not checked against possible errors.
Then I replaced the previous line with this block of code:
which tries several times to send the packet before giving up.
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 );
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);
}
}
}