Skip to main content

Low-to-mid level wrapper for multicast sockets

Project description

multicast.py

Low-to-mid level wrapper for multicast sockets. Simple and cross-platform.

The library is typed, but if you want: DOCS HERE.

Installation

pip install multicast_py

Usage

Creation socket to send multicast packets:

s = MulticastSocket()
s.multicast_ttl = 2  # if needed
s.multicast_loop = False  # if needed, POSIX only (on Windows does nothing)
s.set_multicast_if(address='192.168.0.101')  # local ip, used almost always

s.sendto(b'Multicast message', (group_address, group_port))  # send multicast message

Creation socket to receive multicast packets:

s = MulticastSocket()
s.reuse_addr = True  # if needed
s.multicast_loop = False  # if needed, Windows only (on POSIX does nothing)
s.bind_multicast((group_address, group_port))
s.add_membership(group_address)  # also can specify local address

data = s.recvfrom(1024)  # receive multicast message

License

MIT License. Full test available in LICENSE file.

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

multicast_py-1.0.0.tar.gz (4.8 kB view hashes)

Uploaded Source

Built Distribution

multicast_py-1.0.0-py3-none-any.whl (4.6 kB view hashes)

Uploaded Python 3

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