Justtechjobs.com Find a programming school near you






Online Campus Both


php-windows | 2002071

RE: [PHP-WIN] Check for a listening port... From: Ross Fleming (r.fleming <email protected>)
Date: 07/07/02

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 =  <email protected> ($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:r.fleming <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