In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning. Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "Save the script as Modbus_server.py and then start it."
A block of code is set as follows:
# Import the libraries we need
from pymodbus.server.async import StartTcpServer
from pymodbus.device import ModbusDeviceIdentification
from pymodbus.datastore import ModbusSequentialDataBlock
from pymodbus.datastore import ModbusSlaveContext, ModbusServerContext
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
# Defining the script variables
srcIP = '192.168.179.129'
srcPort = random.randint(1024, 65535)
dstIP = '192.168.179.131'
dstPort = 502
seqNr = random.randint(444, 8765432)
ackNr = 0
transID = random.randint(44,44444)
Any command-line input or output is written as follows:
$ sudo apt-get install python-pip # In case pip did not get installed
$ sudo pip install pyModbus
New terms and important words are shown in bold.
Warnings or important notes appear like this.
Tips and tricks appear like this.