For various reasons I have a requirement to have an app listening on localhost which is proxying output from another app that is not under my control. Currently the OS is buffering too much data (I think >XP the OS buffers >64KB ish?) and I need to try and find a way to crank down the OS buffers without making a system wide registry change

The solution appeared to be to use the TCP_MAXSEG option:
  setsockopt($server, &Socket::IPPROTO_TCP, &Socket::TCP_MAXSEG, 2048);

However, on activestate at least this is giving me:
  Your vendor has not defined Socket macro TCP_MAXSEG, used at xxx

Any ideas on how I can control OS buffering on Win32? (I need it portable eventually, but win32 is my problem right now)

I believe that the trick on windows is to set the advertised MSS window (as above) and this then changes the window size that the sender uses

Right now I can use SO_RCVBUF on the receiving side to turn down the receive buffer, but I am still having problems with the sending buffer (which is outside my control) being way too large for my requirements

Any help please?


In reply to Control TCP_MAXSEG (OS buffering) on Win32 by TheWildgoose

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.