Skip to main content

serp-socket

TCP and UDP sockets for Serpentine. Runtime-backed ([R]): native builds use std::net in the Serpentine runtime; under CPython the same imports delegate to the stdlib socket module. Handles are opaque ints.

from serp_socket import connect, send, recv, close

h: int = connect("127.0.0.1", 8080, 3000)   # 3s connect timeout
send(h, b"ping")
print(recv(h, 4096))
close(h)

API

TCP:

  • connect(host, port, timeout_ms) -> int — timeout_ms > 0 bounds the connect
  • listen(host, port) -> int (port 0 = pick a free port), accept(listener) -> int
  • send(h, data: bytes) -> int (sends everything), recv(h, maxlen) -> bytes (empty = peer closed)
  • shutdown_write(h) — half-close so the peer sees EOF

UDP:

  • udp_bind(host, port) -> int, udp_send_to(h, data, host, port) -> int
  • udp_recv_from(h, maxlen) -> bytes + udp_peer_host(h) / udp_peer_port(h) for the sender

Both:

  • set_timeout(h, ms) (0 = blocking), local_port(h) -> int, close(h)

Errors

Normalized identically in both worlds: OSError with one of "connection refused", "timed out", "connection reset", "address in use", "not connected", "address resolution failed", "socket error"; misuse raises ValueError. IPv4 and IPv6 addresses both work; hostname resolution takes the first result, so prefer explicit IPs (127.0.0.1) when the family matters.

Metadata

Release files for serp-socket 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for serp-socket 0.1.0
File Size Uploaded
serp_socket-0.1.0.tar.gz 4.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for serp-socket 0.1.0
File Interpreter ABI Platform
serp_socket-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 8.1 kB

Release files / serp_socket-0.1.0.tar.gz

Download URL serp_socket-0.1.0.tar.gz
Size 4.3 kB
Tags Source
SHA-256 checksum
How to use checksums
52c416d3ae239d03dc3386dd43e7edcfbcd7a3d5a8802f0fb4dd8285826eca06
BLAKE2b-256 checksum
How to use checksums
a19026c818755105c8dcb392b8d6d058ad595de78c45413a060067d27c44415c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 29, 2026.

Transparency log

Release files / serp_socket-0.1.0-py3-none-any.whl

Download URL serp_socket-0.1.0-py3-none-any.whl
Size 3.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5d2ffa9b6d7b366bd8503678110122314786e436ac9d67a2f48921e58be5cc59
BLAKE2b-256 checksum
How to use checksums
6a51b9da6ededb27ad317db2cba330b0b46d44f88df3a97f93b76f0da1f22085
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 29, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page