Index: mythweb/classes/MythBackend.php
===================================================================
--- mythweb.orig/classes/MythBackend.php	2009-07-15 14:44:31.000000000 -0400
+++ mythweb/classes/MythBackend.php	2009-07-15 15:08:52.000000000 -0400
@@ -49,9 +49,10 @@
         return $Backend[$host][$port];
     }
 
-    function __construct($host, $port) {
+    function __construct($host, $port=null) {
         $this->host = $host;
-        $this->port = $port;
+        $this->ip = _or(setting('BackendServerIP', $this->host), $host);
+        $this->port = _or($port, setting('BackendServerPort', $this->host));
         $this->port_http = _or(setting('BackendStatusPort', $this->host), _or(setting('BackendStatusPort'), 6544));
     }
 
@@ -62,9 +63,9 @@
     private function connect() {
         if ($this->connected)
             return;
-        $this->fp = @fsockopen($this->host, $this->port, $errno, $errstr, 25);
+        $this->fp = @fsockopen($this->ip, $this->port, $errno, $errstr, 25);
         if (!$this->fp)
-            custom_error("Unable to connect to the master backend at {$this->host}:{$this->port}.\nIs it running?");
+            custom_error("Unable to connect to the master backend at {$this->ip}:{$this->port} (hostname: {$this->host}).\nIs it running?");
         $this->connected = true;
         socket_set_timeout($this->fp, 20);
         $this->checkProtocolVersion();
@@ -188,7 +189,7 @@
     }
 
     public function httpRequest($path, $args = array()) {
-        $url = "http://{$this->host}:{$this->port_http}/Myth/{$path}?";
+        $url = "http://{$this->ip}:{$this->port_http}/Myth/{$path}?";
         foreach ($args as $key => $value)
             $url .= $key.'='.urlencode($value).'&';
         return @file_get_contents($url);
