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.2.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.2.0
File Size Uploaded Provenance Actions
serp_socket-0.2.0.tar.gz 7.5 kB With provenance Details for serp_socket-0.2.0.tar.gz

Built distribution (wheel)

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

Total release size: 14.8 kB

Release files / serp_socket-0.2.0.tar.gz

Download URL serp_socket-0.2.0.tar.gz
Size 7.5 kB
Tags Source
SHA-256 checksum
How to use checksums
e9f0424f4d18e72a2ac8a21aefd5b49eb034128a2cbddd7452ef1915fb9d3b39
BLAKE2b-256 checksum
How to use checksums
5cd42ee526c9677fb12ad2dd7da320b5a30e4f6d22969bf8de3ad0f2ee008621
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 27, 2026.

Transparency log

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

Download URL serp_socket-0.2.0-py3-none-any.whl
Size 7.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e47e0d437edfeb184a7d02b4257b3e904b62fe909fd47a6ac64fa19f3839f376
BLAKE2b-256 checksum
How to use checksums
7c0d575a29534968b3a98c07ee6c3dac513eb905d0cbcd91c408b26a8a40fb60
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 27, 2026.

Transparency log

Security for serp-socket 0.2.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for serp_socket-0.2.0.tar.gz

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 Oct 27, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files Full provenance

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