Receiving inputs in a service
We have learned that a service is implemented using an instance method of the same name. It takes two arguments, self
and data
, passed to the service. In Python, data
can be either a string for a STRING
typed buffer, bytes for a CARRAY
typed buffer, or a dictionary for an FML32
typed buffer. In addition to these two positional arguments, several named arguments can be received as well, with the most important being the following:
name
: This is the name of the service that was called. There is not much use for this in Python (unlike C), but it can be used to get the current service name without inspecting the Python function name.flags
: May contain0
orTPTRAN
andTPNOREPLY
flags.TPTRAN
indicates that the service is called within a transaction.TPNOREPLY
indicates that the client is not expecting a response.
If you want to examine all arguments a service receives, you can update the previous example with the following code:
...