Sockets: is there a way to check if the remote host didn't close the connection?
| From: | omri | Date: | Mon, 24 Nov 2003 06:31:54 +0000 |
| Subject: | Sockets: is there a way to check if the remote host didn't close the connection? | ||
| Groups: | php.lang | ||
| Request: | Send a blank email to php-lang+get-542@lists.php.net to get a copy of this message | ||
host,port,connectiontimeout,username,password are pre DEFINEd values
function connect() {
$sock = @fsockopen (host, port, $errno, $errstr, connectiontimeout);
if ( $sock ) {
fputs($sock, username."\n");
fputs($sock, password."\n");
}
return $sock;
}
after sending the username and password, server will check if these values
are correct, if not, it'll disconnect the connection
Is there a way to determine if the connection still exists after I'm sending
the username and the password?
thanks!