Metadata-Version: 2.1
Name: py-netty
Version: 0.0.3
Summary: TCP framework in flavor of Netty
Home-page: https://github.com/ruanhao/py-netty
Author: Hao Ruan
Author-email: ruanhao1116@gmail.com
License: MIT
Keywords: network,tcp
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.7, <4
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: qqutils

# py-netty :rocket:

An epoll-based TCP networking library for Python 3.7+.

APIs are similar to the [Netty](https://netty.io/) framework.



## Installation

```bash
python -m pip install py-netty
```

## Getting Started

Start an echo server:

```python
from py_netty import ServerBootstrap
ServerBootstrap().bind(address='0.0.0.0', port=8080)
```

As TCP client:

```python
from py_netty import Bootstrap
from py_netty.handler import NoOpChannelHandler


class HttpHandler(NoOpChannelHandler):

    def channel_read(self, ctx, buffer):
        print(buffer.decode('utf-8'))

b = Bootstrap(handler=HttpHandler())
channel = b.connect(remote_address, remote_port).sync()
request = f'GET / HTTP/1.1\r\nHost: {remote_address}\r\n\r\n'
channel.write(request.encode('utf-8'))
```

## Performance Test

![Example](https://raw.githubusercontent.com/ruanhao/py-netty/master/rtts_512_32.png)

![Example](https://raw.githubusercontent.com/ruanhao/py-netty/master/rtts_512_2048.png)


