This may sound unusual but I've seen it in use several times. Basically I have a program which sends smtp email. The program works great, but every now and then there will be a server that I open the socket to and it opens correctly, but then when I do a "fputs ..." something, and look for a response "fgets ...", nothing happens, and it just hangs the process.
Does anyone have a good idea on how to timeout the fgets command, or a way to work around it?
/ sending HELO command /
fputs($smtpConnection, "HELO domain.com\r\n");
$response = fgets($smtpConnection,1024);
$status = errorCheck($response);
if ($status['num'] == 1) // if the HELO command was good
By the way, I have seen some servers hang while talking to them both with sendmail and with a straight telnet into port 25, so I know it's not the code or PHP, etc.
Thanks all,
John