Skip to content

Instantly share code, notes, and snippets.

@pietern
Created August 5, 2019 09:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pietern/ecddd844b4f762e3fbe188ee7bf46d01 to your computer and use it in GitHub Desktop.
Save pietern/ecddd844b4f762e3fbe188ee7bf46d01 to your computer and use it in GitHub Desktop.
#!/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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment