[ciapug] Strange DNS error

ciapug@cialug.org ciapug@cialug.org
Mon, 4 Aug 2003 13:21:03 -0400


Hey guys,

I've got a tricky one for you. I hope someone can see the problem because I'm 
compleetely baffled. I have a page that displays status information for a 
server. It includes game server status, uptime, memory utilization, drive 
space utilization, and status of certain services. When I hit the page from my 
PC at work, it's fine. Same with my Mac at home. However, my PC at home and 
everyone else's PC gives a "Page cannot be displayed. Server not found or DNS 
error". I've narrowed down the cause to the service status part of my code, 
but can't for the life of me see why it works on some systems and not on 
others. Here's the code fragment that causes the issue:

<strong>Status of Services:</strong> 
<table cellpadding="0" cellspacing="2">
<?php
$services = array(
	"Apache 2"=>"80",
	"SSH"=>"22",     
	"Telnet"=>"23",
	"FTP"=>"21",
	"SMTP"=>"25",
	"POP3"=>"110",
	"MySQL"=>"3306",
	"Webmin"=>"25432"); 

	foreach ($services as $name=>$port) {
	$host = "localhost";
	$running = @fsockopen($host, $port, $errno, $errstr, 30);
	if (!$running) {
		$status = "down";
	} else {
		fclose($running);
		$status = "up";
	} ?>
<tr><td align=center><img src="<?= $surl ?>images/status_<?= $status?>.gif" 
height="22" width="21"></td><td><?= $name ?></td></tr>
<?php } ?>


Any ideas?