summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2ade388)
raw | patch | inline | side by side (parent: 2ade388)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 30 Nov 2007 11:21:16 +0000 (11:21 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 30 Nov 2007 11:21:16 +0000 (11:21 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7953 594d385d-05f5-0310-b6e9-bd551577e9d8
contrib/socket_server/server.php | patch | blob | history | |
include/class_socketClient.inc | patch | blob | history |
index b6be267415a4a3f2f9806afb019c4fd34fa8bea6..fc7849ac2964cea009e33db9e6694820f193b20b 100755 (executable)
echo "Client disconnected! bye bye!".$clients[$i]['ipaddy']."\n";
}else{
/* Send some data back to the client */
- $data = base64_encode($data);
+ $data = strrev($data);
socket_write($clients[$i]['socket'],$data);
}
}
index 065c9074b01f7778431c5e8738f515be328ea437..3823c466210a102c49a3e2d53cfd23937906e156 100755 (executable)
private $b_data_send = FALSE;
private $handle = NULL;
private $bytes_read = 0;
+ private $error = "";
public function __construct($host, $port, $connect = TRUE,$timeout = 3){
$this->host = $host;
$this->handle = @fsockopen($this->host, $this->port, $this->errno, $this->errstr, $this->timeout);
if(!$this->handle){
$this->handle = NULL;
- echo $this->errstr;
+ $this->error = $this->errstr;
}else{
$this->b_data_send = TRUE;
}
}
+ public function get_error()
+ {
+ return($this->error);
+ }
+
public function write($data){
return($this->send($data));
}
/* Check if there is something to read for us */
$read = array("0"=>$this->handle);
- $num = stream_select($read,$write=NULL,$accept=NULL,$this->timeout);
+ $num = @stream_select($read,$write=NULL,$accept=NULL,$this->timeout);
/* Read data if necessary */
while($num && $this->b_data_send){
$str.= fread($this->handle, 1024000);
$read = array("0"=>$this->handle);
- $num = stream_select($read,$write=NULL,$accept=NULL,$this->timeout);
+ $num = @stream_select($read,$write=NULL,$accept=NULL,$this->timeout);
}
$this->bytes_read = strlen($str);
$this->b_data_send = FALSE;