note 99894 added to function.socket-create

From: Date: Mon, 13 Sep 2010 17:52:53 +0000
Subject: note 99894 added to function.socket-create
Groups: php.notes 
Request: Send a blank email to php-notes+get-172521@lists.php.net to get a copy of this message
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 ---- Server IP: 69.147.83.197 Probable Submitter: 85.183.67.131 ---- Manual Page -- http://www.php.net/manual/en/function.socket-create.php Edit -- https://master.php.net/note/edit/99894 Del: integrated -- https://master.php.net/note/delete/99894/integrated Del: useless -- https://master.php.net/note/delete/99894/useless Del: bad code -- https://master.php.net/note/delete/99894/bad+code Del: spam -- https://master.php.net/note/delete/99894/spam Del: non-english -- https://master.php.net/note/delete/99894/non-english Del: in docs -- https://master.php.net/note/delete/99894/in+docs Del: other reasons-- https://master.php.net/note/delete/99894 Reject -- https://master.php.net/note/reject/99894 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#172521) next »