diff --git a/tcpclient.php b/tcpclient.php index f66a80f..ef86827 100644 --- a/tcpclient.php +++ b/tcpclient.php @@ -74,7 +74,7 @@ class tcpclient $nsRecords = @dns_get_record ($ipOrName, DNS_CNAME); if ($nsRecords === false || $nsRecords == array ()) throw new \Exception ("Can not find the IP for $ipOrName : ". - "DNS Error (No A, AAAA, CNAME entries)", 404); + "DNS Error (No A, AAAA, CNAME entries)", 523); } foreach ($nsRecords as $val) { @@ -172,6 +172,15 @@ class tcpclient $this->socket = $socket; return $this->socket; } + if ($errno === 110) + throw new \Exception ("Can not connect to server $this->ipOrName : ". + "Connection timed out", 522); + if ($errno === 111) + throw new \Exception ("Can not connect to server $this->ipOrName : ". + "Connection refused", 521); + if ($errno === 113) + throw new \Exception ("Can not connect to server $this->ipOrName : ". + "No route to host", 523); throw new \Exception ("Can not connect to server $this->ipOrName : ". $errstr, 500); }