From: Hugh Sasse Staff Elec Eng Date: 2003-02-12T03:53:16+09:00 Subject: Re: Portable FQDM in Ruby? On Wed, 12 Feb 2003, Daniel Berger wrote: > Hugh Sasse Staff Elec Eng wrote: > > > I am trying to get the fully qualified domain name of a machine in a > > way that is posrtable in Ruby. [...] > > I'm trying to take advantage of the portability of ruby here, to > > avoid lots of 'case RUBY_PLATFORM ...' code. > > > > Thank you, > > Hugh > > Hi Hugh, > > The answer is, "I doubt it". > > The info returned from Socket.getaddrinfo (on *nix systems) is the > addrinfo struct information (netdb.h). Specifically, the ai_canonname > char ptr. According to Unix Network Programming Vol I, by Richard > Stevens, "...the ai_canonname member of the first returned structure > points to the canonical name of the host. In terms of the DNS this is > *normally* the FQDN." (emphasis mine). The same is likely true for > Windows systems (WSDATA?), but I'm not sure. OK. I've not really explored DNS in depth yet. > > Also note that the nodename, from the utsname struct, is even less > reliable (Stevens, p. 250). OK. I'll try another solution that doesn't try to find this sort of thing out. > > Regards, > > Dan > > Thank you, Hugh