note 99894 deleted from function.socket-create by danbrown
| From: | danbrown@php.net | Date: | Mon, 13 Sep 2010 20:34:08 +0000 |
| Subject: | note 99894 deleted from function.socket-create by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-172523@lists.php.net to get a copy of this message | ||
Note Submitter: Mihai Moldovan
----
To Kyle Wilson:
Your idea is interesting, but won't always work.
You're assuming, that the local host name provided by the Kernel (which has been most likely
user-set anyway) is:
- a fully qualified domain name or equal
- actually a resolvable address
- actually the RDNS value of the default outgoing IP address.
All three assumptions can prove to be wrong.
For instance, the string provided by php_uname ("n") may just be an arbitrary user-set
string (like "foobar") which actually can't be resolved.
Then, it may happen that the string is resolvable, but does not represent the default outgoing IP
address, i.e., it's just a local (private) address. Note: if only the local address is mapped
on the interface and outgoing traffic routed through a gateway, my proposed solution using ifconfig
and (g)awk will report a "wrong"/local/private address as well.
Last but not least, you may well set the machine's host name to "google.com". In this
case, gethostbyname will return something like 1x3.19x.x7.xxx, which is valid and true, but
definitely not your default outgoing address. :)
I guess there is no perfect solution for this problem.
Best regards,
Mihai