A library based on asyncore, used to build tcp server/client application communicating each other with customized messages.
Examples
Server:
import asynmsg
@asynmsg.with_message_handler_config
class ServerSession(asynmsg.SessionS):
@asynmsg.message_handler_config('Login')
def on_Login(self, msg_id, msg_data):
self.send_message('LoginAck', 'login success')
class Server(asynmsg.Server):
session_class = ServerSession
Server(('127.0.0.1', 12345))
asynmsg.run_forever()
Client:
import asynmsg
@asynmsg.with_message_handler_config
class ClientSession(asynmsg.SessionC):
def on_opened(self):
asynmsg.SessionC.on_opened(self)
self.send_message('Login', 'test1')
@asynmsg.message_handler_config('LoginAck')
def on_LoginAck(self, msg_id, msg_data):
pass
class Client(asynmsg.ClientBlockConnect):
session_class = ClientSession
client = Client(('127.0.0.1', 12345))
if client.is_started():
asynmsg.run_forever()
Release files for asynmsg 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| asynmsg-0.1.6.zip | 11.4 kB | Details |
Release files / asynmsg-0.1.6.zip
| Download URL | asynmsg-0.1.6.zip |
|---|---|
| Size | 11.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
13f8ed4ec5b653430e536b9c65045fff990ee5592d443ec043ce657fed253b64
|
|
BLAKE2b-256 checksum How to use checksums |
a92bd8b62609946f7c629285d3ed4185a05e1ef40afcf91aa0fba630bf2384c7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |