Easy UDP communication library
Project description
Easy UDP
Easy UDP is a Python package that simplifies UDP communication. It provides convenient classes for UDP Sender and Receiver implementations.
Installation
pip install easy-udp
Usage
UDP Sender
from easy_udp import UDPSender
import numpy as np
# Create UDP sender instance
udp_sender = UDPSender(host="localhost", port=12345, send_pause=0.000001)
# Sending data
print("Sending: 123")
udp_sender.send(123)
print("Sending: Hello, World!")
udp_sender.send("Hello, World!")
img = np.random.randint(0, 255, (1280, 720, 3), dtype=np.uint8)
print("Sending: img", img)
udp_sender.send(img)
UDP Receiver
from easy_udp import UDPReceiver
import numpy as np
# Create UDP receiver instance
udp_receiver = UDPReceiver(host="localhost", port=12345, timeout=1.0)
# receive data
while True:
received_data = udp_receiver.receive()
if received_data is not None:
if isinstance(received_data, np.ndarray):
received_data = received_data.reshape((1280, 720, 3))
print("Received: img", received_data)
if isinstance(received_data, str):
print("Received: str", received_data)
if isinstance(received_data, int):
print("Received: int", received_data)
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
easy_udp-0.1.4.tar.gz
(4.0 kB
view details)
Built Distribution
File details
Details for the file easy_udp-0.1.4.tar.gz
.
File metadata
- Download URL: easy_udp-0.1.4.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 52e45c7466a17894a2257a4ff1be092c63a94e1a13a9e75e550465e839b428ab |
|
MD5 | 9b64d40347d17013be4dfe98e202a0cf |
|
BLAKE2b-256 | 5f04c38321d83cdaea4e287d34b0422208253b2406430e8e287d72aaa1f2e0af |
File details
Details for the file easy_udp-0.1.4-py3-none-any.whl
.
File metadata
- Download URL: easy_udp-0.1.4-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0258663f764a2dac1ef107b2f85451847fc80340b537bfae1a397f12a04a425a |
|
MD5 | cc51400dbfdd08d5aed3216bdf0a978d |
|
BLAKE2b-256 | f34ac86baddff48d5282e6f47a97577dfbac3dcd3af349fc28b095cc4ababbc2 |