Module: nagvis Branch: master Commit: facd2bdd4db7dc82e21d6e8dda491d940785e303 URL: http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis;a=commit;h=facd2bdd4db7dc82e21d6e8dda491d940785e303
Author: Lars Michelsen <[email protected]> Date: Sat Oct 31 19:58:07 2009 +0100 Added several comments --- .../core/classes/GlobalBackendmklivestatus.php | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/share/server/core/classes/GlobalBackendmklivestatus.php b/share/server/core/classes/GlobalBackendmklivestatus.php index 74ad74d..7596571 100644 --- a/share/server/core/classes/GlobalBackendmklivestatus.php +++ b/share/server/core/classes/GlobalBackendmklivestatus.php @@ -105,6 +105,7 @@ class GlobalBackendmklivestatus implements GlobalBackendInterface { * @author Lars Michelsen <[email protected]> */ private function queryLivestatus($query) { + // Create socket connection $sock = socket_create(AF_UNIX, SOCK_STREAM, 0); if($sock == false) { @@ -112,6 +113,7 @@ class GlobalBackendmklivestatus implements GlobalBackendInterface { return Array(); } + // Connect to the socket $result = socket_connect($sock, $this->socketPath); if($result == false) { @@ -123,13 +125,16 @@ class GlobalBackendmklivestatus implements GlobalBackendInterface { socket_write($sock, $query . "OutputFormat:json\n"); socket_shutdown($sock, 1); + // Read all information from the response and add it to a string $read = ''; while('' != ($r = socket_read($sock, 65536))) { $read .= $r; } + // Important: The socket needs to be closed after reading socket_close($sock); + // Returning an array return json_decode($read); } ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Nagvis-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/nagvis-checkins
