+ /**
+ * Tries to resolve an IP address from given hostname. Currently only IPv
+ * addresses are resolved.
+ *
+ * @param $hostname Host name we shall resolve
+ * @return $ip IP address resolved from host name
+ */
+ protected function resolveIpAddress ($hostname) {
+ // Debug message
+ $this->debugOutput(sprintf("[%s:] Our host name is: <span class=\"data\">%s</span>",
+ $this->__toString(),
+ $hostname
+ ));
+
+ // Default is an invalid one
+ $ip = '0.0.0.0';
+
+ // Resolve it
+ $ipResolved = gethostbyname($hostname);
+
+ // Was it fine?
+ if (($ipResolved !== false) && ($ipResolved != $hostname)) {
+ // Okay, this works!
+ $ip = $ipResolved;
+
+ // Debug message
+ $this->debugOutput(sprintf("[%s:] Resolved IP address is: <span class=\"data\">%s</span>\n",
+ $this->__toString(),
+ $ip
+ ));
+ } // END - if
+
+ // Return resolved IP
+ return $ip;
+ }
+