Never mind, after an hour of scouring the manual I found out about sockets
and knocked this up:

<?php
$port = 8000;
$address = '127.0.0.1';
$socket = socket_create(AF_INET, SOCK_STREAM, 0);
$result = @socket_connect ($socket, $address, $port);

if ($result) {
header("location: http://localhost:8000/listen.pls";);
} else {
echo "Server is down";
}

socket_close ($socket);
?>

-----Original Message-----
From: Ross Fleming [mailto:[EMAIL PROTECTED]]
Sent: 07 July 2002 17:47
To: PHP Windows mailing list
Subject: [PHP-WIN] Check for a listening port...


Hi all

Short request: I'm looking for a php script that will test for a listening
port, (specifically port 8000 on the same server, say localhost).  Basically
if port 8000 is active, I want to redirect to that, otherwise display a page
that says "service offline" or something.

Any ideas?

Cheers

Ross


--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to