Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

OT: Random useless misnamed Windows constants and cargo-cultism

by Chmrr (Vicar)
on Dec 05, 2001 at 17:19 UTC ( #129590=note: print w/replies, xml ) Need Help??

in reply to Re: Simple UDP example anyone?
in thread Simple UDP example anyone?

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:

  • MSG_OOB is supposed to be a flag which signals "urgent" or "priority" messages. It's what catches control-C in Telnet connections, for example. When used with recv, it serves as a filter, only recv'ing "priority" packets. It doesn't work with UDP, though.
  • MSG_PEEK allows you to recv the first packet without taking it off of the server's stack of waiting packets. This is of dubious usefulness, but actually works under windows.
  • MSG_DONTROUTE probably does what it implies. I didn't have much way to test this.

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'

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://129590]
[perldigious]: Or is my irritation/ frustration well founded?
[Corion]: perldigious: That seems to be more the export and likely it's the recipients of that export that like the titles changes
[Corion]: ... "changed"
[Corion]: I usually expect fixed header names, but am sometimes lenient in the order of columns. But changing the report titles often sounds to me as if you are not the sole consument of the export ;)
[shmem]: perldigious: as always - if it ain't broke, don't fix it. Ther must be a very compelling reason for changing column names in a database. Those are rare.
[Corion]: If you have whitespace in the column names in the database, whap the DBAs ;)

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (8)
As of 2017-05-25 13:33 GMT
Find Nodes?
    Voting Booth?