From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,9ff14974e69ded8a X-Google-Attributes: gidfee84,public X-Google-Thread: f9325,9ff14974e69ded8a X-Google-Attributes: gidf9325,public From: lemahieu@paradise.caltech.edu Subject: Re: UDP buffer size? setsockopt(SOL_SOCKET, SO_RCVBUF) Date: 1996/07/25 Message-ID: <31F7C3CF.41C6@paradise.caltech.edu>#1/1 X-Deja-AN: 170178765 references: <4sleu1$5ps@nntp.atlanta.com> content-type: text/plain; charset=us-ascii organization: California Institute of Technology, Pasadena mime-version: 1.0 newsgroups: comp.unix.osf.osf1,comp.protocols.tcp-ip x-mailer: Mozilla 2.0 (X11; I; AIX 2) Ralph Doncaster wrote: > > Curt Smith wrote: > > > > Does anyone know how to raise the buffer size to 64kb or larger, > > so for example, 64 1024byte packets can be sent in a tight loop > > before the receiving task will start seeing dropped packets?? > > > > How about the header file: > > > > /sys/include/net/bpf.h: > > > > #define BPF_MAXBUFSIZE 0x8000 > > Did you try setsockopt(SO_SNDBUF...)? I think you'll find that most Linux systems come with max buffer size of 32K for a socket. Using setsockopt(SO_SNDBUF) can only set it up to this maximum size. This system parameter can probably be changed by recompiling the kernel and setting some option, or there may be some other way to set this maximum buffer size. Systems I've seen usually range from 32K to ~64K max buf size (Linux typically 32K, AIX typically ~64K, Sun OS typically ~52K, but all should be configurable at the kernel by a sysadmin). Be aware that if you're using UDP, setting a sendbuf size only has the effect of essentially setting the maximum packet size you can send. Repeatedly sending many small UDP packets very quickly can result in local packet losses due to lack of buffer space, and this may not be reported back to you as an error when you do the send. This is probably implementation dependent (I know this happens in AIX, I don't know about Linux). Anyways, take it into consideration for portable code if you happen to be using UDP. --Paul