The Util module provides useful communications services -- such
as receiving data until a given string is found. It is a 'translation' module
since it manipulates its sent/received data.
The create function can be used to create a Util
module eg.
(create Util)
Once created, this module is tailored using its properties
and methods.
A Util module supports the following properties:
| property name | property type | description |
|---|---|---|
readParity |
String | parity to impose upon received data -- values are one of:
odd, even, strip or preserve
|
writeParity |
String | parity to impose upon data sent -- values are one of:
odd, even, strip or preserve
|
log |
Log | a log for the communications |
trafficGroup |
String | traffic statistics for data transmitted through a Util
comms module can be collected for a group of such modules -- this is the
traffic group. Statistics are gathered for all Util
modules within the same traffic group and can be returned using
the traffic method. |
inactivityTimeout |
Integer | the inactivity timeout value (seconds) for the session -- NOTE: this value stored so that a script accessing the module can take the appropriate action: the module does not set a timer to disconnect the session automatically |
The Util module supports the following methods:
| method name | description |
|---|---|
receiveN |
attempt to receive exactly the supplied no. of bytes |
receiveUntil |
receive data until the supplied string is received |
traffic |
returns a CommsInfo
object for all data collected for the supplied traffic
group |
resetTraffic |
resets the CommsInfo
object for all data collected for the supplied traffic
group |
The standard comms module methods are also supported:
| method name | description |
|---|---|
connect |
connect this module |
receive |
receive data |
receiveInto |
receive data into the supplied buffer |
send |
send data |
disconnect |
disconnect this module |
bind |
bind address information for this module |
listen |
prepare to listen for new connections |
accept |
wait for a new connection to arrive and, if it does, accept it |
receiveNAttempt to receive exactly the supplied no. of bytes.
Arguments:
| nToRead | Integer |
| timeout | Integer |
Return type: Binary -- an
error is raised if insufficient data is received in time.
receiveUntilReceive data until the supplied string is received.
Arguments:
| test | String |
| timeout | Integer |
Return type: Binary -- an
error is raised if insufficient data is received in time.
traffic
Returns a CommsInfo
object for all data collected for the supplied traffic
group.
Arguments:
| groupName | String |
Return type: CommsInfo
resetTraffic
Resets the CommsInfo
object for all data collected for the supplied traffic
group.
Arguments:
| groupName | String |
Return type: the empty List
| Contents | Index | Current topic: communications | Related topics: communications classes, objects |