From: hickert Date: Fri, 30 Nov 2007 11:21:16 +0000 (+0000) Subject: Updated client & server X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=98234084e29e56a714d253d9d4a0089a98cb7ad9;p=gosa.git Updated client & server git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7953 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/contrib/socket_server/server.php b/contrib/socket_server/server.php index b6be26741..fc7849ac2 100755 --- a/contrib/socket_server/server.php +++ b/contrib/socket_server/server.php @@ -109,7 +109,7 @@ Type some text here:\n"); 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); } } diff --git a/include/class_socketClient.inc b/include/class_socketClient.inc index 065c9074b..3823c4662 100755 --- a/include/class_socketClient.inc +++ b/include/class_socketClient.inc @@ -10,6 +10,7 @@ class Socket_Client 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; @@ -30,12 +31,17 @@ class Socket_Client $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)); } @@ -66,13 +72,13 @@ class Socket_Client /* 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;