The lightning-fast tcp and udp server.
Project description
Uvicontainer
Ported from uvicorn, Aim to be a fast general TCP/UDP servcer
example
import asyncio
import uvicontainer
class EchoServerProtocol(asyncio.Protocol):
def connection_made(self, transport):
peername = transport.get_extra_info('peername')
print('Connection from {}'.format(peername))
self.transport = transport
def data_received(self, data):
message = data.decode()
print('Data received: {!r}'.format(message))
print('Send: {!r}'.format(message))
self.transport.write(data)
print('Close the client socket')
self.transport.close()
if __name__ == "__main__":
uvicontainer.run("main:EchoServerProtocol", host="0.0.0.0", port=8000, workers=3, type="tcp")
- This starts a tcp server, like that in python's document
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
uvicontainer-0.1.1rc1.tar.gz
(29.8 kB
view details)
Built Distribution
File details
Details for the file uvicontainer-0.1.1rc1.tar.gz
.
File metadata
- Download URL: uvicontainer-0.1.1rc1.tar.gz
- Upload date:
- Size: 29.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 967b020dddf495b4232344dc2ef58ee0ce829b28f641d69c0851cc6811768011 |
|
MD5 | 6d743b58f8cacd057c0c6a117b278069 |
|
BLAKE2b-256 | 2ddf4152716dc958c4eb7a78e3a93d9d42037915806bdf0e5af129bb73d07254 |
File details
Details for the file uvicontainer-0.1.1rc1-py3-none-any.whl
.
File metadata
- Download URL: uvicontainer-0.1.1rc1-py3-none-any.whl
- Upload date:
- Size: 42.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 576cd6697694694bebeb2d247be9ff20431a777911ceb01429dc7a87ee37e97c |
|
MD5 | 628dceab48a95c4f06f3b98e675120ff |
|
BLAKE2b-256 | ad4ef0bc2be6188143b2d099f8df3c3fe854feba30de1c741eb466c59901475b |