Skip to main content

No project description provided

Project description

Implementation of select.poll for Windows.

  • Pure Python; no C extensions (uses ctypes.windll)
  • Drop-in-compatible API
  • Clean "ponyfill"; no monkeypatching
  • No dependencies (besides Windows Vista or newer)
  • Python 3.6+ compatible

Usage

try:
  from select import POLLIN, POLLOUT, poll
except ImportError:
  # https://github.com/python/cpython/issues/60711
  from winpoll import POLLIN, POLLOUT, wsapoll as poll

p = poll()

p.register(sock1, POLLIN)
p.register(sock2, POLLIN | POLLOUT)
p.unregister(sock1)

for sock, events in p.poll(timeout=3):
    print(f"Socket {sock} is ready with {events}")

# like select.poll objects, winpoll.wsapoll objects acquire no resources
# thus have no cleanup requirement besides plain garbage collection

Limitations / Bugs

  • Does not work before Windows Vista.

  • Outbound TCP connections don't correctly report failure-to-connect ((POLLHUP | POLLERR | POLLWRNORM)) before Windows 10 Version 2004 (OS build 19041).

Installation

Command-line

pip install winpoll

requirements.txt

winpoll

pyproject.toml

[project]
dependencies = [
  ...,
  "winpoll",
]

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

winpoll-0.20287.0.tar.gz (7.5 kB view details)

Uploaded Source

File details

Details for the file winpoll-0.20287.0.tar.gz.

File metadata

  • Download URL: winpoll-0.20287.0.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.9

File hashes

Hashes for winpoll-0.20287.0.tar.gz
Algorithm Hash digest
SHA256 afef7a4542f6dfea5ac984c93a0bff3370ec19e3aee94a98de583f29c61ede52
MD5 e410153a5a20413108ac6f7e99896662
BLAKE2b-256 9cb898ad4b482569100c0ead25f8a7f855ceff5cd9dfc327d27bedb3b7a6b2dd

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