index 93e49de40190e2da5eb36409d2c88536157d0ac7..fa3e488d9b71deb661c2af3cf3e38871d39dbf57 100644 (file)
private $handle = NULL;
private $bytes_read = 0;
private $error = "";
private $handle = NULL;
private $bytes_read = 0;
private $error = "";
- private $b_encrypt = FALSE;
+ private $is_error = FALSE;
+ private $b_encrypt = FALSE;
/* Crypto information */
private $td= NULL;
/* Crypto information */
private $td= NULL;
$this->host= $host;
$this->port= $port;
$this->timeout= $timeout;
$this->host= $host;
$this->port= $port;
$this->timeout= $timeout;
+ $this->reset_error();
/* Connect if needed */
if($connect){
/* Connect if needed */
if($connect){
public function setEncryptionKey($key)
{
if(!function_exists("mcrypt_get_iv_size")){
public function setEncryptionKey($key)
{
if(!function_exists("mcrypt_get_iv_size")){
- $this->error = _("The mcrypt module was not found. Please install php5-mcrypt.");
+ $this->set_error(msgPool::missingext("mcrypt"));
$this->ckey = "";
$this->b_encrypt = FALSE;
}
$this->ckey = "";
$this->b_encrypt = FALSE;
}
public function open()
{
public function open()
{
+ $this->reset_error();
$this->handle = @fsockopen($this->host, $this->port, $this->errno, $this->errstr, $this->timeout);
if(!$this->handle){
$this->handle = NULL;
$this->handle = @fsockopen($this->host, $this->port, $this->errno, $this->errstr, $this->timeout);
if(!$this->handle){
$this->handle = NULL;
- $this->error = $this->errstr;
+ $this->set_error(sprintf(_("Socket connection to %s:%s failed: %s"), bold($this->host), bold($this->port), $this->errstr));
}else{
$this->b_data_send = TRUE;
}else{
$this->b_data_send = TRUE;
}
}
+ public function set_error($str)
+ {
+ $this->is_error =TRUE;
+ $this->error=$str;
+ }
+
+
+ public function reset_error()
+ {
+ $this->is_error =FALSE;
+ $this->error = "";
+ }
+
+
+ public function is_error()
+ {
+ return($this->is_error);
+ }
+
+
public function get_error()
{
return $this->error;
public function get_error()
{
return $this->error;
public function read()
{
// Output the request results
public function read()
{
// Output the request results
+ $this->reset_error();
$str = "";
$data = "test";
socket_set_timeout($this->handle,$this->timeout);
$str = "";
$data = "test";
socket_set_timeout($this->handle,$this->timeout);
}
}
}
}
}
}
- if((microtime(TRUE) - $start) > $this->timeout ){
+ if((microtime(TRUE) - $start) > $this->timeout ){
+ $this->set_error(sprintf(_("Socket timeout of %s seconds reached!"), bold($this->timeout)));
break;
}
}
break;
}
}