|Welcome to the Monastery|
Yeah, I'm responding to my own post. This is because what follows is really a rather off-topic rant on my part, and not really related to the question asked above.
So I got vaguely interested in figuring out what exactly that useless-looking $flags variable was there for. I quickly learned that, unlike $datagram, it's not modified by send or recv, as I had anticipated. Rather, it's says "make me a packet with this set of flags" or "do this special thing when trolling for packets."
It just happens that one of the machines that I tested my UDP code on was a machine running Windows and ActivePerl. So I started poking around, looking at which constant values for the flags were defined. Under Windows, I found exactly four: MSG_OOB, MSG_PEEK, MSG_DONTROUTE, and MSG_MAXIOVLEN. These, of course, were nicely mysterious to me, so I set out to see what I could see about each:
And this brings me to my main victim -- MSG_MAXIOVLEN. Not only does it have the most ugly-looking name, it's apparently only defined under Windows. A Google search for it shows up a decent number of hits -- but upon careful perusal, every one of them defines it as a constant with no comment after it. In fact, the Winsock specification does the exact same thing -- defined, with no comment, and never refenced again. In an example of huge-scale cargo-cultism, hundreds of header files, including every Windows-based Perl install out there, have copied an absolutly useless constant which is not implemented or described anywhere. A little further reasearch shows that it might be implemented on the UNICOS/mk cray operating system. And even if it is, it's misnamed, as it's not a flag on a message at all, but an arbitrary constant of the TCP stack!
So there's the sordid tale of a misnamed, unimplmented, useless, but omnipresent constant. Gah!
perl -pe '"I lo*`+$^X$\"$]!$/"=~m%(.*)%s;$_=$1;y^+*`^ ve^#$&V"+@( NO CARRIER'
In reply to OT: Random useless misnamed Windows constants and cargo-cultism