hvl_ccb.comm.tcp¶
TCP communication protocol. Makes use of the socket library.
- class Tcp(configuration)[source]¶
Bases:
hvl_ccb.comm.base.CommunicationProtocol
Tcp Communication Protocol.
- static config_cls() Type[hvl_ccb.comm.tcp.TcpCommunicationConfig] [source]¶
Return the default configdataclass class.
- Returns
a reference to the default configdataclass class
- class TcpCommunicationConfig(host: str, port: int = 54321, bufsize: int = 1024)[source]¶
Bases:
object
Configuration dataclass for
TcpCommunication
.- bufsize: int = 1024¶
- force_value(fieldname, value)¶
Forces a value to a dataclass field despite the class being frozen.
NOTE: you can define post_force_value method with same signature as this method to do extra processing after value has been forced on fieldname.
- Parameters
fieldname – name of the field
value – value to assign
- host: str¶
- is_configdataclass = True¶
- classmethod keys() Sequence[str] ¶
Returns a list of all configdataclass fields key-names.
- Returns
a list of strings containing all keys.
- classmethod optional_defaults() Dict[str, object] ¶
Returns a list of all configdataclass fields, that have a default value assigned and may be optionally specified on instantiation.
- Returns
a list of strings containing all optional keys.
- port: int = 54321¶
- classmethod required_keys() Sequence[str] ¶
Returns a list of all configdataclass fields, that have no default value assigned and need to be specified on instantiation.
- Returns
a list of strings containing all required keys.