Hi, I have Apache 1.3.29+PHP 4.3.6 on WinXP. I need to check some services (ftp, http, smtp) on other machines for availability. --- Method 1 --- So I try to use fsockopen: $handle = fsockopen($ip, $port, $errno, $errstr, 5); if ($handle) { close($handle); $online=1; } else { $online=0; } Everything looks fine, but there is one problem. Apache open 2 kind of connections when I call fsockopen. It looks in TCPView like: apache.exe src_host:src_port host:0 LISTENING apache.exe src_host:src_port dest_host:dest_port SYN_SENT When 5 seconds timeout occurs, apache closes second connection, but leave first connection alive! So, if I try to call fsockopen 1000 times, I got 1000 connections from apache in LISTENING state! Is there any ways to solve this problem? --- Method 2 --- When I try to use socket_connect, there is other problem appear. $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); $exist = socket_connect($socket, $host, $port); if ($exist) { socket_shutdown($socket); socket_close($socket); $online=1; } else { $online=0; } Socket_close works normally, but it leaves connection in TIME_WAIT state. This connections closes automaticaly when time_wait timeout occurs, but this timeout is very large! How I can make it smaller? --- Method 3, etc? --- Or may be there exist some other ways to check port and services for availability??? With best regards, Sherry. -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php