Skip to main content

UDP helper function for robotics workload.

Project description

UDPack

API-Docs-status

UDPack is a minimal Python wrapper around UDP sockets. It provides a single UDP class that acts as a full-duplex communication channel—bind an address to receive, specify a target to send, or do both.

Designed for lightweight robotics, networking utilities, and quick prototypes.

Installation

pip install udpack

Usage

import numpy as np
from udpack import UDP

# Full duplex: listen on 8000, send to 8001
udp = UDP(recv_addr=("0.0.0.0", 8000), send_addr=("127.0.0.1", 8001))

# Raw bytes
udp.send(b"hello")
data = udp.recv()  # None on timeout

# Dict (JSON)
udp.send_dict({"x": 1.0, "y": 2.0})
obj = udp.recv_dict()

# NumPy arrays
udp.send_numpy(np.array([1, 2, 3], dtype=np.float32))
arr = udp.recv_numpy(dtype=np.float32)

udp.stop()

Constructor

  • recv_addr(host, port) to bind and listen; None for transmit-only.
  • send_addr(host, port) of the remote peer; None for receive-only.

Timeouts

Pass timeout to recv, recv_dict, or recv_numpy:

  • None — blocking (wait forever)
  • 0 — non-blocking (~0.1s poll)
  • > 0 — block for that many seconds

API

Method Description
recv / send Raw bytes
recv_dict / send_dict JSON-serialized dicts
recv_numpy / send_numpy NumPy arrays (configurable dtype)
stop Close the socket

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

udpack-2026.3.1.tar.gz (103.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

udpack-2026.3.1-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file udpack-2026.3.1.tar.gz.

File metadata

  • Download URL: udpack-2026.3.1.tar.gz
  • Upload date:
  • Size: 103.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.19

File hashes

Hashes for udpack-2026.3.1.tar.gz
Algorithm Hash digest
SHA256 014f63a6af2c4a2e977e2dd19f9cbe4ad1e3fb4a2894bee4c63f65f69f953214
MD5 1ceccbd45b62f2587cc9647be4fbef65
BLAKE2b-256 2935294d48c2eeb58028924e78300b575467900bd51045cccd18b206816e0cfb

See more details on using hashes here.

File details

Details for the file udpack-2026.3.1-py3-none-any.whl.

File metadata

  • Download URL: udpack-2026.3.1-py3-none-any.whl
  • Upload date:
  • Size: 4.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.19

File hashes

Hashes for udpack-2026.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 242b7db0f75e48f74fa3b733c990f24ed9f538f3dfdc622a18faccf6edb67c2c
MD5 1ae413919107d1829bc996b19c720814
BLAKE2b-256 8d5d07e6eddbb8ade220a60b880f794c8bf176fa2792944f442a18f206d28414

See more details on using hashes here.

Supported by

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