aboutsummaryrefslogtreecommitdiffstats
path: root/zmq-rx-data.py
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2014-04-16 23:07:19 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2014-04-16 23:07:19 +0200
commit0683f8f24372162fc6adf2e99415b0831af17801 (patch)
treea8af01d51be5b0cfb2e559afa4509264d9bc2aab /zmq-rx-data.py
parenta92d30abae24fbc024310b141daeeffd143421f9 (diff)
downloadmmbtools-aux-0683f8f24372162fc6adf2e99415b0831af17801.tar.gz
mmbtools-aux-0683f8f24372162fc6adf2e99415b0831af17801.tar.bz2
mmbtools-aux-0683f8f24372162fc6adf2e99415b0831af17801.zip
Add small zmq python test scripts
Diffstat (limited to 'zmq-rx-data.py')
-rwxr-xr-xzmq-rx-data.py41
1 files changed, 41 insertions, 0 deletions
diff --git a/zmq-rx-data.py b/zmq-rx-data.py
new file mode 100755
index 0000000..b0b58ce
--- /dev/null
+++ b/zmq-rx-data.py
@@ -0,0 +1,41 @@
+#!/usr/bin/env python
+# Copyright (C) 2013 Matthias P. Braendli
+# http://mpb.li
+#
+# This file is part of CRC-DabMux.
+#
+# CRC-DabMux is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# CRC-DabMux is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with CRC-DabMux. If not, see <http://www.gnu.org/licenses/>.
+#
+#
+# This is python3 code, it will probably not work on python2.
+# TODO fix that
+
+import sys
+import zmq
+
+context = zmq.Context()
+
+sock = context.socket(zmq.SUB)
+
+sock.connect("tcp://localhost:9100")
+#sock.bind("tcp://*:9000")
+
+# set a filter that lets everything through
+sock.setsockopt(zmq.SUBSCRIBE, bytes([]))
+
+sys.stderr.write("Entering loop\n")
+while True:
+ data = sock.recv(flags=0, copy=True, track=False)
+
+ sys.stdout.buffer.write(data)