Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for dhtcplib, version 0.2.1
Filename, size File type Python version Upload date Hashes
Filename, size dhtcplib-0.2.1.tar.gz (3.9 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page