public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Paulo Marques <pmarques@grupopie.com>
To: johnny zhao <filamoon2@hotmail.com>
Cc: vda@port.imtp.ilyichevsk.odessa.ua, linux-kernel@vger.kernel.org
Subject: Re: udp packet loss even with large socket buffer
Date: Tue, 02 Mar 2004 12:58:26 +0000	[thread overview]
Message-ID: <404484F2.5020706@grupopie.com> (raw)
In-Reply-To: BAY14-F15j87cUL2cZ00000613e@hotmail.com

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?"


  reply	other threads:[~2004-03-02 13:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-28 22:08 udp packet loss even with large socket buffer johnny zhao
2004-03-02 12:58 ` Paulo Marques [this message]
  -- strict thread matches above, loose matches on Subject: below --
2004-03-03  0:16 johnny zhao
2004-02-28  1:09 johnny zhao
2004-02-28 21:22 ` Denis Vlasenko
2004-03-02  2:12   ` Charlie (Zhanglei) Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=404484F2.5020706@grupopie.com \
    --to=pmarques@grupopie.com \
    --cc=filamoon2@hotmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vda@port.imtp.ilyichevsk.odessa.ua \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox