This depends very much on your OS defaults and any distro-level or admin-level tuning. The actual definition of buffer window and receive size are frequently set to the maximum possible size by implementations, but you can adjust this in the application level. I merely said this has an impact on the TCP-window size, per the manpage reference I gave earlier.

Remember, the stock Linux or BSD kernel defaults can be adjusted by kernel maintainers (changing official upstream options,) by an admin who uses knobs like sysctl tuning to adjust defaults, or by applications that have some say over userland tooling (such as the socket-level options we're discussing here.) I can't tell you exactly what impact your change to the SO_RECVBUF size will have since I do not know the defaults on your current system. Use the above resources to find out, or learn more about them. Remember, sometimes you get a bit "dirty" learning how all the layers in an modern system interact. Test and see what the impact is for you.

Finally, note that the definitive reference for Window Scaling is RFC-1323. Specifically, section 2.1 talks about the need for buffer sizes large enough to make window-scaling effective. This is probably why the API documentation for tcp on various platforms frequently mentions this fact. It's quite possible your kernel/sysctl/userland is already using the "largest possible" buffers, in which case the behavior your noted may be quite correct. This may not be the case on someone else's OS, distro, or configuration.

FYI, your code is a bit hard to read; use <code> tags to increase readability by printing the code as you wrote it (markup docs are helpful too.)


In reply to Re^3: changing tcp parameters when establishing connection by Apero
in thread changing tcp parameters when establishing connection by iThunder

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.