Skip to main content

A multicast framework and tools

Project description

PyMarko

in development

Example

#!/usr/bin/env python3
from pymarko.udpsocket import Publisher
from pymarko.udpsocket import Subscriber
import time
import sys

HOST, PORT = "10.0.1.116", 9999

def pub():
    pub = Publisher()
    pub.info()
    pub.clientaddr.append((HOST, PORT))
    pub.clientaddr.append((HOST, 9998)) # this one will fail quietly

    for _ in range(20):
        msg = str(time.time()).encode("utf-8")
        pub.publish(msg)

def sub():

    def cb(data):
        print(data)

    try:
        s = Subscriber()
        s.bind(HOST, PORT)
        s.info()
        s.register_cb(cb)
        s.loop()

    except KeyboardInterrupt as e:
        s.event = False
        time.sleep(0.1)
        print(e)
        print("ctrl-z")


if __name__ == "__main__":
    if sys.argv[1] == "p":
        pub()
    elif sys.argv[1] == "s":
        sub()

MIT License

Copyright (c) 2018 Kevin J. Walchko

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pymarko-0.5.0.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

pymarko-0.5.0-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file pymarko-0.5.0.tar.gz.

File metadata

  • Download URL: pymarko-0.5.0.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.10.4 Darwin/21.3.0

File hashes

Hashes for pymarko-0.5.0.tar.gz
Algorithm Hash digest
SHA256 5ebd9b0433b3b4e9699829cb2618bddd8bc10e319cb1b82bcb380016b7b10ce8
MD5 63926d060cdf845441c97266489b8217
BLAKE2b-256 6328ba0fdeac6d7e3e90143a8435087d1a785852bc6b815fd7b94a41707ab29c

See more details on using hashes here.

File details

Details for the file pymarko-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: pymarko-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.10.4 Darwin/21.3.0

File hashes

Hashes for pymarko-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5ca75d9dbda755a1a7ee9c516869cd7f59423212b27991173680581796d98617
MD5 ba00f05ffb2cb9ae123df87214bb774f
BLAKE2b-256 4e9c952268140fc09f600bd8a03fa2cfbb397c0d3b9eddbad5ea030a66685956

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page