Skip to content

Instantly share code, notes, and snippets.

@pietern
Created August 5, 2019 09:22
Show Gist options
  • Select an option

  • Save pietern/ecddd844b4f762e3fbe188ee7bf46d01 to your computer and use it in GitHub Desktop.

Select an option

Save pietern/ecddd844b4f762e3fbe188ee7bf46d01 to your computer and use it in GitHub Desktop.

Revisions

  1. pietern created this gist Aug 5, 2019.
    15 changes: 15 additions & 0 deletions nanomsg_pub.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    #!/usr/bin/env python

    from nanomsg import Socket, PUB
    import time
    import sys

    pub = Socket(PUB)
    pub.bind('tcp://127.0.0.1:5000')

    # Publishes 1MB of data per second.
    # Adjust as needed.
    while True:
    buf = sys.stdin.read(1024 * 1024)
    pub.send(buf)
    time.sleep(1)