Re: setsockopt



On Sep 11, 10:59 pm, Jack <junw2...@xxxxxxxxx> wrote:

LINE1 gets the default UDP buffer size. LINE2 sets a new value. LINE3
gets the new UDP buffer size. When running the code on Linux system,
why the output at LINE3 is double the value at LINE2? For example, if
udpbuf0 is 11000, the output of LINE3 is 22000.

One is measured in application data bytes, the other is measured in
kernel data+metadata bytes. The 'setsockopt' is basically saying "I
wan't about this many *data* bytes to fit in the queue". The
'getsockopt' is basically asking "how big is the queue". The queue has
to be larger than the number of data bytes because things like source
addresses have to be stored in the queue as well as data.

So you are getting a different answer because you are asking a
different question.

DS

.