lkml.org 
[lkml]   [2004]   [Mar]   [2]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateTue, 02 Mar 2004 12:58:26 +0000
FromPaulo Marques <>
SubjectRe: udp packet loss even with large socket buffer
johnny zhao wrote:

> hi,
> 
> Since my program is coping with MSN, it's not easy to post a small 
> example. But I will try :)
> 
> I use the following code to initialize the socket:
> 
> *****************************
>     session->rtp.loc_addr.sin_family = AF_INET;
>     session->rtp.loc_addr.sin_addr.s_addr = INADDR_ANY;
>     session->rtp.loc_addr.sin_port = htons (port);
>     session->rtp.socket = socket (PF_INET, SOCK_DGRAM, 0);

                                                         ^^^
This should really be IPPROTO_UDP as defined in <netinet/in.h>


>     g_return_val_if_fail (session->rtp.socket > 0, -1);
>     err = bind (session->rtp.socket,
>             (struct sockaddr *) &session->rtp.loc_addr,
>             sizeof (struct sockaddr_in));
>     /* set the address reusable */
>     err = setsockopt (session->rtp.socket, SOL_SOCKET, SO_REUSEADDR,
>               (void*)&optval, sizeof (optval));
> 
>     optval = 8388608;


You are right, this is really a huuuuuge buffer. If you are getting a 1.5kb 
packet every 80 ms on average, this is about 20kb/second. Even a 64kb buffer 
should be much more than enough.
My advice is just request a 64kb buffer, and stop messing with the rmem_default 
and rmem_max parameters.


-- 
Paulo Marques - www.grupopie.com
"In a world without walls and fences who needs windows and gates?"

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:01    [W:0.170 / U:0.010 seconds]
©2003-2008 Jasper Spaans