php-windows Digest 10 May 2004 07:36:27 -0000 Issue 2244
Topics (messages 23652 through 23653):
Re: Mail
23652 by: Jonathan Villa
Re: How to check port conection? socket_connect and fso ckopen have problems
23653 by: Svensson, B.A.T. (HKG)
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
Did you change the reporting level to see if anything gets reported...
-----Original Message-----
From: Andreas Lindahl [mailto:[EMAIL PROTECTED]
Sent: Sunday, May 09, 2004 3:13 AM
To: [EMAIL PROTECTED]
Subject: [PHP-WIN] Mail
My mail function doesn�t work at all. I have tried a very simple line to
send the mail,
but nothing happens. The mail will not send, and the function doesn�t
return
anything.
I have made the neccesary changes in php.ini.
$result = mail("[EMAIL PROTECTED]", "Test", "Line Test");
Does anyone have a clue why I don�t even get anything in return from the
function.
/Andreas
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Why do you need to call a socket 1000 times in order
to find out if a service is available or not?
-----Original Message-----
From: Sherry
To: [EMAIL PROTECTED]
Sent: 8-5-2004 17:03
Subject: [PHP-WIN] How to check port conection? socket_connect and fsockopen
have problems
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
--- End Message ---