Detecting hostname == localhost?
Thiago Macieira
thiagom at wanadoo.fr
Fri Sep 13 11:48:14 BST 2002
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Michael Goffioul wrote:
>I've got a problem that should be fixed before 3.1. I want to detect
>that a given hostname corresponds to localhost. The hostname may be
>in alphabetical or IP address form. Is there an easy way to do that
>using KDE classes?
The known hostnames "localhost", "*" and "127.0.0.1" (and "::1" for IPv6) are
guaranteed to be localhost and you could even hardcode that. However, there
are other several possibilities of loopback that won't show up unless you
perform a lookup.
That is the case for "localhost.localdomain" and any other "localhost.*" that
will show up only by reading /etc/hosts and DNS queries. If that is
acceptable, I think we could add a member (static?) function isLocalhost() to
KInetSocketAddress that would return true in case an address is localhost.
However, this would be a new feature...
PS: that would probably be best in KAddressInfo or in the proposed
KInetAddress class.
- --
Thiago Macieira - UFOT Registry number: 1001
thiagom at mail.com
ICQ UIN: 1967141 PGP/GPG: 0x6EF45358
Registered Linux user #65028
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
iD8DBQE9gcJvM/XwBW70U1gRAonJAJ4kFwSCsOMYwENXDn2UeCaqljE1/wCdFtWH
xLzwDt5wOcZY492imk1OAGQ=
=j0Cr
-----END PGP SIGNATURE-----
More information about the kde-core-devel
mailing list