diff --git a/examples/Python/Client.bat b/examples/Python/Client.bat deleted file mode 100644 index f8b5331..0000000 --- a/examples/Python/Client.bat +++ /dev/null @@ -1,3 +0,0 @@ -"python" %~dp0\Client.py - -pause \ No newline at end of file diff --git a/examples/Python/Client_Complete.bat b/examples/Python/Client_Complete.bat new file mode 100644 index 0000000..1801683 --- /dev/null +++ b/examples/Python/Client_Complete.bat @@ -0,0 +1,3 @@ +"python" %~dp0\Client_Complete.py + +pause \ No newline at end of file diff --git a/examples/Python/Client.py b/examples/Python/Client_Complete.py similarity index 100% rename from examples/Python/Client.py rename to examples/Python/Client_Complete.py diff --git a/examples/Python/Client_Simple.bat b/examples/Python/Client_Simple.bat new file mode 100644 index 0000000..6991101 --- /dev/null +++ b/examples/Python/Client_Simple.bat @@ -0,0 +1,3 @@ +"python" %~dp0\Client_Simple.py + +pause \ No newline at end of file diff --git a/examples/Python/Client_Simple.py b/examples/Python/Client_Simple.py new file mode 100644 index 0000000..74afe3a --- /dev/null +++ b/examples/Python/Client_Simple.py @@ -0,0 +1,49 @@ +import zlib +import zmq.green as zmq +import simplejson +import sys + +""" + " Configuration +""" +__relayEDDN = 'tcp://eddn-relay.elite-markets.net:9500' +__timeoutEDDN = 600000 + + +""" + " Start +""" +def main(): + context = zmq.Context() + subscriber = context.socket(zmq.SUB) + + subscriber.setsockopt(zmq.SUBSCRIBE, "") + subscriber.setsockopt(zmq.RCVTIMEO, __timeoutEDDN) + + while True: + try: + subscriber.connect(__relayEDDN) + + while True: + __message = subscriber.recv() + + if __message == False: + subscriber.disconnect(__relayEDDN) + break + + __message = zlib.decompress(__message) + __json = simplejson.loads(__message) + + + print __json + sys.stdout.flush() + + except zmq.ZMQError, e: + print 'ZMQSocketException: ' + str(e) + sys.stdout.flush() + time.sleep(10) + + + +if __name__ == '__main__': + main()