A simple TCP client/server framework
Project description
Dhtcplib
--------
dhtcplib makes threaded TCP servers and connections to servers really easy.
```````````````
::
from time import sleep
from dhtcplib import dhtcp
'''
Start the server
'''
class MyHandlerClass:
def handle(data):
print("Handler got data: ", data)
return(data)
# Using a defined class with a 'handle' method to route requests
my_serv = dhtcp("127.0.0.1", 9000, RouterClass=MyHandlerClass)
my_serv.start()
try:
while True:
print("Do something in your main thread while the server slaves away!")
sleep(5)
except KeyboardInterrupt:
'''
Shutdown the server
'''
my_serv.kill()
And Easy to Install
```````````````````
::
$ pip3 install dhtcplib
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
dhtcplib-0.2.1.tar.gz
(3.9 kB
view hashes)