diff --git a/examples/PHP/Client.bat b/examples/PHP/Client.bat deleted file mode 100644 index dc20b3f..0000000 --- a/examples/PHP/Client.bat +++ /dev/null @@ -1,3 +0,0 @@ -"php.exe" -f %~dp0\Client.php - -pause \ No newline at end of file diff --git a/examples/PHP/Client_Complete.bat b/examples/PHP/Client_Complete.bat new file mode 100644 index 0000000..d27aed9 --- /dev/null +++ b/examples/PHP/Client_Complete.bat @@ -0,0 +1,3 @@ +"php.exe" -f %~dp0\Client_Complete.php + +pause \ No newline at end of file diff --git a/examples/PHP/Client.php b/examples/PHP/Client_Complete.php similarity index 100% rename from examples/PHP/Client.php rename to examples/PHP/Client_Complete.php diff --git a/examples/PHP/Client_Simple.bat b/examples/PHP/Client_Simple.bat new file mode 100644 index 0000000..9bdd435 --- /dev/null +++ b/examples/PHP/Client_Simple.bat @@ -0,0 +1,3 @@ +"php.exe" -f %~dp0\Client_Simple.php + +pause \ No newline at end of file diff --git a/examples/PHP/Client_Simple.php b/examples/PHP/Client_Simple.php new file mode 100644 index 0000000..47d36ce --- /dev/null +++ b/examples/PHP/Client_Simple.php @@ -0,0 +1,49 @@ +getSocket(ZMQ::SOCKET_SUB); + +$subscriber->setSockOpt(ZMQ::SOCKOPT_SUBSCRIBE, ""); +$subscriber->setSockOpt(ZMQ::SOCKOPT_RCVTIMEO, $timeoutEDDN); + +while (true) +{ + try + { + $subscriber->connect($relayEDDN); + + while (true) + { + $message = $subscriber->recv(); + + if ($message === false) + { + $subscriber->disconnect($relayEDDN); + break; + } + + $message = zlib_decode($message); + $json = json_decode($message, true); + + fwrite(STDOUT, $json . PHP_EOL); + } + } + catch (ZMQSocketException $e) + { + fwrite(STDOUT, 'ZMQSocketException: ' . $e . PHP_EOL); + sleep(10); + } +} + +// Exit correctly +exit(0); \ No newline at end of file diff --git a/examples/Python/Client_Simple.py b/examples/Python/Client_Simple.py index 74afe3a..ef40d9d 100644 --- a/examples/Python/Client_Simple.py +++ b/examples/Python/Client_Simple.py @@ -10,6 +10,7 @@ __relayEDDN = 'tcp://eddn-relay.elite-markets.net:9500' __timeoutEDDN = 600000 + """ " Start """