socket_comm¶
Description
Server/client communication via TCP sockets.
The module implements TCP communication between
a daemon-like Server
and a simple
Client
.
The Server
class is meant to be
run as a daemon-like app. The user should
override the create_parser()
method to define the daemon behaviour upon
reception of a message from a Client
.
The base class provides support for the
message ‘quit’, which will terminate the
daemon. Any other message will be met with
a help-like reply.
The Client
class communicates with
the Server
sending a text string.
The ArgumentParser
class and
MessageError
exception are
necessary to override some unwanted
default behaviour of the
argparse
library.
The module is based upon this tutorial.
Classes
Modifies some annoying behaviours of the |
|
Simple TCP client to communicate with a running |
|
Daemon-like TCP server. |
Exceptions
Invalid message. |