Re: udp packet loss even with large socket buffer
From: Paulo Marques (pmarques_at_grupopie.com)
Date: 03/02/04
- Previous message: Brian Gerst: "[PATCH] Clean up empty_zero_page abuse"
- Maybe in reply to: Charlie (Zhanglei) Wang: "Re: udp packet loss even with large socket buffer"
- Next in thread: johnny zhao: "Re: udp packet loss even with large socket buffer"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 02 Mar 2004 12:58:26 +0000 To: johnny zhao <filamoon2@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?" - 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/
- Previous message: Brian Gerst: "[PATCH] Clean up empty_zero_page abuse"
- Maybe in reply to: Charlie (Zhanglei) Wang: "Re: udp packet loss even with large socket buffer"
- Next in thread: johnny zhao: "Re: udp packet loss even with large socket buffer"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|