> The only possible optimization would be the size of the temporary > buffer (currently 256). Roy mentioned that the address array in > hostent has a maximum of 10 entries. If so, the size of the > structure plus the maximum size of the array (10 entries) may be > sufficient. If we send in a too small buffer, we should > receive ERANGE.
Er, did I say that? Not enough sugar, I guess. I meant that normal DNS responses were effectively limited to 10, due to a limitation in some other client operating system or web browser, such that there wasn't much point in having a round-robin table with more than ten entries. I'm not sure what the actual receive limit is on Solaris. Also, I think the buffer might be used for both hostent and the two lists of names/aliases, which would make the memory need much larger than 256. It should be a symbol, in any case, so that people can redefine it per platform. The test needs to be a bit more complicated than that, since Solaris has different definitions of gethostbyname_r defined based on the POSIX level. Bugger, it looks like the Solaris man page is recommending against that function anyway, in favor of getipnodebyname() because the old ones won't work with IPv6. What's the likelihood that it will be portable? Perhaps we should write a test for each and use the best one found. ....Roy
