Skip to main content

Concurrency agnostic socket API

Project description

sockio

A concurrency agnostic socket library on python.

So far implemented REQ-REP semantics with auto-reconnection facilites.

Implementations for:

  • classic blocking API
  • future based API
  • asyncio

Join the party by bringing your own concurrency library with a PR!

I am looking in particular for implementations over trio and curio.

Installation

From within your favourite python environment:

pip install sockio

Usage

asyncio

import asyncio
from sockio.aio import Socket

async def main():
    sock = Socket('acme.example.com', 5000)
    # Assuming a SCPI complient on the other end we can ask for:
    reply = await sock.write_readline(b'*IDN?\n')
    print(reply)

asyncio.run(main())

classic

from sockio.sio import Socket

sock = Socket('acme.example.com', 5000)
# Assuming a SCPI complient on the other end we can ask for:
reply = sock.write_readline(b'*IDN?\n')
print(reply)

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

sockio-0.1.4.tar.gz (3.4 kB view hashes)

Uploaded Source

Supported by

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