Skip to main content

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


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)

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