Sockets: is there a way to check if the remote host didn't close the connection?
[email protected] ("omri") Mon, 24 Nov 2003 08:31:54 +0200
| Newsgroups | php.lang |
|---|---|
| Message-ID | <[email protected]> |
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!