cadric Posted July 24, 2006 Share Posted July 24, 2006 I am trying to get this small script working that I managed to put together. It works...with tcp..but whenever I try to use it with udp(which is what I want to check) the script will always show the server is online, even if its not..My server will always show it online:http://einherjers.dk/test/status.phpThat port this script use is not open..Does anyone know what I am doing wrong?[code]<?php$host = "udp://einherjers.dk";$port = "886";$output = @fsockopen($host, $port, $errno, $errstr, 2); if (!$output) { echo "<img src='http://einherjers.dk/account3/images/offline.gif' alt='Offline' />"; } else { echo"<img src='http://einherjers.dk/account3/images/online.gif' alt='Online' />";@fclose($output);}?>[/code] Quote Link to comment Share on other sites More sharing options...
trq Posted July 24, 2006 Share Posted July 24, 2006 What do $errno and $errstr produce? Quote Link to comment Share on other sites More sharing options...
cadric Posted July 24, 2006 Author Share Posted July 24, 2006 Ignore.. Quote Link to comment Share on other sites More sharing options...
trq Posted July 24, 2006 Share Posted July 24, 2006 I know what they do.... Im asking you what they contain. Quote Link to comment Share on other sites More sharing options...
cadric Posted July 24, 2006 Author Share Posted July 24, 2006 Oh sorry..But then I suppose it contains this if I set it too output the error: [b](0)[/b] Quote Link to comment Share on other sites More sharing options...
trq Posted July 24, 2006 Share Posted July 24, 2006 What (copy and paste) is the output of....[code=php:0]<?php$host = "udp://einherjers.dk";$port = "886";$output = @fsockopen($host, $port, $errno, $errstr, 2); if (!$output) { echo "offline: $errno, $errstr";} else { echo "offline: $errno, $errstr";}@fclose($output);?>[/code]when the server is both offline and online? Quote Link to comment Share on other sites More sharing options...
cadric Posted July 24, 2006 Author Share Posted July 24, 2006 same for both.. and still:[b]offline: 0, [/b] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.