Class ModbusClient
- Namespace
- Fluent
Modbus
- Assembly
- FluentModbus.dll
A base class for Modbus client implementations.
- Inheritance
-
Modbus
Client
- Derived
Methods
MaskWriteRegister()
This methdod is not implemented.
MaskWriteRegisterAsync()
This methdod is not implemented.
Returns
ReadCoils(int, int, int)
Reads the specified number of coils as byte array. Each bit of the returned array represents a single coil.
Parameters
unitIdentifier
intThe unit identifier is used to communicate via devices such as bridges, routers and gateways that use a single IP address to support multiple independent Modbus end units. Thus, the unit identifier is the address of a remote slave connected on a serial line or on other buses. Use the default values 0x00 or 0xFF when communicating to a Modbus server that is directly connected to a TCP/IP network.
startingAddress
intThe coil start address for the read operation.
quantity
intThe number of coils to read.
Returns
ReadCoilsAsync(int, int, int, CancellationToken)
Reads the specified number of coils as byte array. Each bit of the returned array represents a single coil.
public Task<Memory<byte>> ReadCoilsAsync(int unitIdentifier, int startingAddress, int quantity, CancellationToken cancellationToken = default)
Parameters
unitIdentifier
intThe unit identifier is used to communicate via devices such as bridges, routers and gateways that use a single IP address to support multiple independent Modbus end units. Thus, the unit identifier is the address of a remote slave connected on a serial line or on other buses. Use the default values 0x00 or 0xFF when communicating to a Modbus server that is directly connected to a TCP/IP network.
startingAddress
intThe coil start address for the read operation.
quantity
intThe number of coils to read.
cancellationToken
CancellationToken The token to monitor for cancellation requests. The default value is None.
Returns
ReadDiscreteInputs(int, int, int)
Reads the specified number of discrete inputs as byte array. Each bit of the returned array represents a single discrete input.
Parameters
unitIdentifier
intThe unit identifier is used to communicate via devices such as bridges, routers and gateways that use a single IP address to support multiple independent Modbus end units. Thus, the unit identifier is the address of a remote slave connected on a serial line or on other buses. Use the default values 0x00 or 0xFF when communicating to a Modbus server that is directly connected to a TCP/IP network.
startingAddress
intThe discrete input start address for the read operation.
quantity
intThe number of discrete inputs to read.
Returns
ReadDiscreteInputsAsync(int, int, int, CancellationToken)
Reads the specified number of discrete inputs as byte array. Each bit of the returned array represents a single discrete input.
public Task<Memory<byte>> ReadDiscreteInputsAsync(int unitIdentifier, int startingAddress, int quantity, CancellationToken cancellationToken = default)
Parameters
unitIdentifier
intThe unit identifier is used to communicate via devices such as bridges, routers and gateways that use a single IP address to support multiple independent Modbus end units. Thus, the unit identifier is the address of a remote slave connected on a serial line or on other buses. Use the default values 0x00 or 0xFF when communicating to a Modbus server that is directly connected to a TCP/IP network.
startingAddress
intThe discrete input start address for the read operation.
quantity
intThe number of discrete inputs to read.
cancellationToken
CancellationToken The token to monitor for cancellation requests. The default value is None.
Returns
ReadFifoQueue()
This methdod is not implemented.
ReadFifoQueueAsync()
This methdod is not implemented.
Returns
ReadFileRecord()
This methdod is not implemented.
ReadFileRecordAsync()
This methdod is not implemented.
Returns
ReadHoldingRegisters(byte, ushort, ushort)
Low level API. Use the generic version of this method for easier access. Reads the specified number of values as byte array from the holding registers.
public Span<byte> ReadHoldingRegisters(byte unitIdentifier, ushort startingAddress, ushort quantity)
Parameters
unitIdentifier
byteThe unit identifier is used to communicate via devices such as bridges, routers and gateways that use a single IP address to support multiple independent Modbus end units. Thus, the unit identifier is the address of a remote slave connected on a serial line or on other buses. Use the default values 0x00 or 0xFF when communicating to a Modbus server that is directly connected to a TCP/IP network.
startingAddress
ushortThe holding register start address for the read operation.
quantity
ushortThe number of holding registers (16 bit per register) to read.
Returns
ReadHoldingRegistersAsync(byte, ushort, ushort, CancellationToken)
Low level API. Use the generic version of this method for easier access. Reads the specified number of values as byte array from the holding registers.
public Task<Memory<byte>> ReadHoldingRegistersAsync(byte unitIdentifier, ushort startingAddress, ushort quantity, CancellationToken cancellationToken = default)
Parameters
unitIdentifier
byteThe unit identifier is used to communicate via devices such as bridges, routers and gateways that use a single IP address to support multiple independent Modbus end units. Thus, the unit identifier is the address of a remote slave connected on a serial line or on other buses. Use the default values 0x00 or 0xFF when communicating to a Modbus server that is directly connected to a TCP/IP network.
startingAddress
ushortThe holding register start address for the read operation.
quantity
ushortThe number of holding registers (16 bit per register) to read.
cancellationToken
CancellationToken The token to monitor for cancellation requests. The default value is None.
Returns
ReadHoldingRegistersAsync<T>(int, int, int, CancellationToken)
Reads the specified number of values of type T
from the holding registers.
public Task<Memory<T>> ReadHoldingRegistersAsync<T>(int unitIdentifier, int startingAddress, int count, CancellationToken cancellationToken = default) where T : unmanaged
Parameters
unitIdentifier
intThe unit identifier is used to communicate via devices such as bridges, routers and gateways that use a single IP address to support multiple independent Modbus end units. Thus, the unit identifier is the address of a remote slave connected on a serial line or on other buses. Use the default values 0x00 or 0xFF when communicating to a Modbus server that is directly connected to a TCP/IP network.
startingAddress
intThe holding register start address for the read operation.
count
intThe number of elements of type
T
to read.cancellationToken
CancellationToken The token to monitor for cancellation requests. The default value is None.
Returns
Type Parameters
T
Determines the type of the returned data.
ReadHoldingRegisters<T>(int, int, int)
Reads the specified number of values of type T
from the holding registers.
public Span<T> ReadHoldingRegisters<T>(int unitIdentifier, int startingAddress, int count) where T : unmanaged
Parameters
unitIdentifier
intThe unit identifier is used to communicate via devices such as bridges, routers and gateways that use a single IP address to support multiple independent Modbus end units. Thus, the unit identifier is the address of a remote slave connected on a serial line or on other buses. Use the default values 0x00 or 0xFF when communicating to a Modbus server that is directly connected to a TCP/IP network.
startingAddress
intThe holding register start address for the read operation.
count
intThe number of elements of type
T
to read.
Returns
- Span<T>
Type Parameters
T
Determines the type of the returned data.
ReadInputRegisters(byte, ushort, ushort)
Low level API. Use the generic version of this method for easier access. Reads the specified number of values as byte array from the input registers.
Parameters
unitIdentifier
byteThe unit identifier is used to communicate via devices such as bridges, routers and gateways that use a single IP address to support multiple independent Modbus end units. Thus, the unit identifier is the address of a remote slave connected on a serial line or on other buses. Use the default values 0x00 or 0xFF when communicating to a Modbus server that is directly connected to a TCP/IP network.
startingAddress
ushortThe input register start address for the read operation.
quantity
ushortThe number of input registers (16 bit per register) to read.
Returns
ReadInputRegistersAsync(byte, ushort, ushort, CancellationToken)
Low level API. Use the generic version of this method for easier access. Reads the specified number of values as byte array from the input registers.
public Task<Memory<byte>> ReadInputRegistersAsync(byte unitIdentifier, ushort startingAddress, ushort quantity, CancellationToken cancellationToken = default)
Parameters
unitIdentifier
byteThe unit identifier is used to communicate via devices such as bridges, routers and gateways that use a single IP address to support multiple independent Modbus end units. Thus, the unit identifier is the address of a remote slave connected on a serial line or on other buses. Use the default values 0x00 or 0xFF when communicating to a Modbus server that is directly connected to a TCP/IP network.
startingAddress
ushortThe input register start address for the read operation.
quantity
ushortThe number of input registers (16 bit per register) to read.
cancellationToken
CancellationToken The token to monitor for cancellation requests. The default value is None.
Returns
ReadInputRegistersAsync<T>(int, int, int, CancellationToken)
Reads the specified number of values of type T
from the input registers.
public Task<Memory<T>> ReadInputRegistersAsync<T>(int unitIdentifier, int startingAddress, int count, CancellationToken cancellationToken = default) where T : unmanaged
Parameters
unitIdentifier
intThe unit identifier is used to communicate via devices such as bridges, routers and gateways that use a single IP address to support multiple independent Modbus end units. Thus, the unit identifier is the address of a remote slave connected on a serial line or on other buses. Use the default values 0x00 or 0xFF when communicating to a Modbus server that is directly connected to a TCP/IP network.
startingAddress
intThe input register start address for the read operation.
count
intThe number of elements of type
T
to read.cancellationToken
CancellationToken The token to monitor for cancellation requests. The default value is None.
Returns
Type Parameters
T
Determines the type of the returned data.
ReadInputRegisters<T>(int, int, int)
Reads the specified number of values of type T
from the input registers.
public Span<T> ReadInputRegisters<T>(int unitIdentifier, int startingAddress, int count) where T : unmanaged
Parameters
unitIdentifier
intThe unit identifier is used to communicate via devices such as bridges, routers and gateways that use a single IP address to support multiple independent Modbus end units. Thus, the unit identifier is the address of a remote slave connected on a serial line or on other buses. Use the default values 0x00 or 0xFF when communicating to a Modbus server that is directly connected to a TCP/IP network.
startingAddress
intThe input register start address for the read operation.
count
intThe number of elements of type
T
to read.
Returns
- Span<T>
Type Parameters
T
Determines the type of the returned data.
ReadWriteMultipleRegisters(byte, ushort, ushort, ushort, byte[])
Low level API. Use the generic version of this method for easier access. Reads the specified number of values as byte array from and writes the provided byte array to the holding registers. The write operation is performed before the read.
public Span<byte> ReadWriteMultipleRegisters(byte unitIdentifier, ushort readStartingAddress, ushort readQuantity, ushort writeStartingAddress, byte[] dataset)
Parameters
unitIdentifier
byteThe unit identifier is used to communicate via devices such as bridges, routers and gateways that use a single IP address to support multiple independent Modbus end units. Thus, the unit identifier is the address of a remote slave connected on a serial line or on other buses. Use the default values 0x00 or 0xFF when communicating to a Modbus server that is directly connected to a TCP/IP network.
readStartingAddress
ushortThe holding register start address for the read operation.
readQuantity
ushortThe number of holding registers (16 bit per register) to read.
writeStartingAddress
ushortThe holding register start address for the write operation.
dataset
byte[]The byte array to write to the server. A minimum of two bytes is required.
Returns
ReadWriteMultipleRegistersAsync(byte, ushort, ushort, ushort, byte[], CancellationToken)
Low level API. Use the generic version of this method for easier access. Reads the specified number of values as byte array from and writes the provided byte array to the holding registers. The write operation is performed before the read.
public Task<Memory<byte>> ReadWriteMultipleRegistersAsync(byte unitIdentifier, ushort readStartingAddress, ushort readQuantity, ushort writeStartingAddress, byte[] dataset, CancellationToken cancellationToken = default)
Parameters
unitIdentifier
byteThe unit identifier is used to communicate via devices such as bridges, routers and gateways that use a single IP address to support multiple independent Modbus end units. Thus, the unit identifier is the address of a remote slave connected on a serial line or on other buses. Use the default values 0x00 or 0xFF when communicating to a Modbus server that is directly connected to a TCP/IP network.
readStartingAddress
ushortThe holding register start address for the read operation.
readQuantity
ushortThe number of holding registers (16 bit per register) to read.
writeStartingAddress
ushortThe holding register start address for the write operation.
dataset
byte[]The byte array to write to the server. A minimum of two bytes is required.
cancellationToken
CancellationToken The token to monitor for cancellation requests. The default value is None.
Returns
ReadWriteMultipleRegistersAsync<TRead, TWrite>(int, int, int, int, TWrite[], CancellationToken)
Reads the specified number of values of type TRead
from and writes the provided array of type TWrite
to the holding registers. The write operation is performed before the read.
public Task<Memory<TRead>> ReadWriteMultipleRegistersAsync<TRead, TWrite>(int unitIdentifier, int readStartingAddress, int readCount, int writeStartingAddress, TWrite[] dataset, CancellationToken cancellationToken = default) where TRead : unmanaged where TWrite : unmanaged
Parameters
unitIdentifier
intThe unit identifier is used to communicate via devices such as bridges, routers and gateways that use a single IP address to support multiple independent Modbus end units. Thus, the unit identifier is the address of a remote slave connected on a serial line or on other buses. Use the default values 0x00 or 0xFF when communicating to a Modbus server that is directly connected to a TCP/IP network.
readStartingAddress
intThe holding register start address for the read operation.
readCount
intThe number of elements of type
TRead
to read.writeStartingAddress
intThe holding register start address for the write operation.
dataset
TWrite[]The data of type
TWrite
to write to the server.cancellationToken
CancellationToken The token to monitor for cancellation requests. The default value is None.
Returns
Type Parameters
TRead
Determines the type of the returned data.
TWrite
Determines the type of the provided data.
ReadWriteMultipleRegisters<TRead, TWrite>(int, int, int, int, TWrite[])
Reads the specified number of values of type TRead
from and writes the provided array of type TWrite
to the holding registers. The write operation is performed before the read.
public Span<TRead> ReadWriteMultipleRegisters<TRead, TWrite>(int unitIdentifier, int readStartingAddress, int readCount, int writeStartingAddress, TWrite[] dataset) where TRead : unmanaged where TWrite : unmanaged
Parameters
unitIdentifier
intThe unit identifier is used to communicate via devices such as bridges, routers and gateways that use a single IP address to support multiple independent Modbus end units. Thus, the unit identifier is the address of a remote slave connected on a serial line or on other buses. Use the default values 0x00 or 0xFF when communicating to a Modbus server that is directly connected to a TCP/IP network.
readStartingAddress
intThe holding register start address for the read operation.
readCount
intThe number of elements of type
TRead
to read.writeStartingAddress
intThe holding register start address for the write operation.
dataset
TWrite[]The data of type
TWrite
to write to the server.
Returns
- Span<TRead>
Type Parameters
TRead
Determines the type of the returned data.
TWrite
Determines the type of the provided data.
TransceiveFrame(byte, ModbusFunctionCode, Action<ExtendedBinaryWriter>)
Sends the requested modbus message and waits for the response.
protected abstract Span<byte> TransceiveFrame(byte unitIdentifier, ModbusFunctionCode functionCode, Action<ExtendedBinaryWriter> extendFrame)
Parameters
unitIdentifier
byteThe unit identifier.
functionCode
ModbusFunction Code The function code.
extendFrame
Action<ExtendedBinary >Writer An action to be called to extend the prepared Modbus frame with function code specific data.
Returns
TransceiveFrameAsync(byte, ModbusFunctionCode, Action<ExtendedBinaryWriter>, CancellationToken)
Sends the requested modbus message and waits for the response.
protected abstract Task<Memory<byte>> TransceiveFrameAsync(byte unitIdentifier, ModbusFunctionCode functionCode, Action<ExtendedBinaryWriter> extendFrame, CancellationToken cancellationToken = default)
Parameters
unitIdentifier
byteThe unit identifier.
functionCode
ModbusFunction Code The function code.
extendFrame
Action<ExtendedBinary >Writer An action to be called to extend the prepared Modbus frame with function code specific data.
cancellationToken
CancellationToken The token to monitor for cancellation requests. The default value is None.
Returns
WriteFileRecord()
This methdod is not implemented.
WriteFileRecordAsync()
This methdod is not implemented.
Returns
WriteMultipleCoils(int, int, bool[])
Writes the provided values
to the coil registers.
Parameters
unitIdentifier
intThe unit identifier is used to communicate via devices such as bridges, routers and gateways that use a single IP address to support multiple independent Modbus end units. Thus, the unit identifier is the address of a remote slave connected on a serial line or on other buses. Use the default values 0x00 or 0xFF when communicating to a Modbus server that is directly connected to a TCP/IP network.
startingAddress
intThe coil register start address for the write operation.
values
bool[]The values to write to the server.
WriteMultipleCoilsAsync(int, int, bool[], CancellationToken)
Writes the provided values
to the coil registers.
public void WriteMultipleCoilsAsync(int unitIdentifier, int startingAddress, bool[] values, CancellationToken cancellationToken = default)
Parameters
unitIdentifier
intThe unit identifier is used to communicate via devices such as bridges, routers and gateways that use a single IP address to support multiple independent Modbus end units. Thus, the unit identifier is the address of a remote slave connected on a serial line or on other buses. Use the default values 0x00 or 0xFF when communicating to a Modbus server that is directly connected to a TCP/IP network.
startingAddress
intThe coil register start address for the write operation.
values
bool[]The values to write to the server.
cancellationToken
CancellationToken The token to monitor for cancellation requests. The default value is None.
WriteMultipleRegisters(byte, ushort, byte[])
Low level API. Use the generic version of this method for easier access. Writes the provided byte array to the holding registers.
Parameters
unitIdentifier
byteThe unit identifier is used to communicate via devices such as bridges, routers and gateways that use a single IP address to support multiple independent Modbus end units. Thus, the unit identifier is the address of a remote slave connected on a serial line or on other buses. Use the default values 0x00 or 0xFF when communicating to a Modbus server that is directly connected to a TCP/IP network.
startingAddress
ushortThe holding register start address for the write operation.
dataset
byte[]The byte array to write to the server. A minimum of two bytes is required.
WriteMultipleRegistersAsync(byte, ushort, byte[], CancellationToken)
Low level API. Use the generic version of this method for easier access. Writes the provided byte array to the holding registers.
public Task WriteMultipleRegistersAsync(byte unitIdentifier, ushort startingAddress, byte[] dataset, CancellationToken cancellationToken = default)
Parameters
unitIdentifier
byteThe unit identifier is used to communicate via devices such as bridges, routers and gateways that use a single IP address to support multiple independent Modbus end units. Thus, the unit identifier is the address of a remote slave connected on a serial line or on other buses. Use the default values 0x00 or 0xFF when communicating to a Modbus server that is directly connected to a TCP/IP network.
startingAddress
ushortThe holding register start address for the write operation.
dataset
byte[]The byte array to write to the server. A minimum of two bytes is required.
cancellationToken
CancellationToken The token to monitor for cancellation requests. The default value is None.
Returns
WriteMultipleRegistersAsync<T>(int, int, T[], CancellationToken)
Writes the provided array of type T
to the holding registers.
public Task WriteMultipleRegistersAsync<T>(int unitIdentifier, int startingAddress, T[] dataset, CancellationToken cancellationToken = default) where T : unmanaged
Parameters
unitIdentifier
intThe unit identifier is used to communicate via devices such as bridges, routers and gateways that use a single IP address to support multiple independent Modbus end units. Thus, the unit identifier is the address of a remote slave connected on a serial line or on other buses. Use the default values 0x00 or 0xFF when communicating to a Modbus server that is directly connected to a TCP/IP network.
startingAddress
intThe holding register start address for the write operation.
dataset
T[]The data of type
T
to write to the server.cancellationToken
CancellationToken The token to monitor for cancellation requests. The default value is None.
Returns
Type Parameters
T
Determines the type of the provided data.
WriteMultipleRegisters<T>(int, int, T[])
Writes the provided array of type T
to the holding registers.
public void WriteMultipleRegisters<T>(int unitIdentifier, int startingAddress, T[] dataset) where T : unmanaged
Parameters
unitIdentifier
intThe unit identifier is used to communicate via devices such as bridges, routers and gateways that use a single IP address to support multiple independent Modbus end units. Thus, the unit identifier is the address of a remote slave connected on a serial line or on other buses. Use the default values 0x00 or 0xFF when communicating to a Modbus server that is directly connected to a TCP/IP network.
startingAddress
intThe holding register start address for the write operation.
dataset
T[]The data of type
T
to write to the server.
Type Parameters
T
Determines the type of the provided data.
WriteSingleCoil(int, int, bool)
Writes the provided value
to the coil registers.
Parameters
unitIdentifier
intThe unit identifier is used to communicate via devices such as bridges, routers and gateways that use a single IP address to support multiple independent Modbus end units. Thus, the unit identifier is the address of a remote slave connected on a serial line or on other buses. Use the default values 0x00 or 0xFF when communicating to a Modbus server that is directly connected to a TCP/IP network.
registerAddress
intThe coil address for the write operation.
value
boolThe value to write to the server.
WriteSingleCoilAsync(int, int, bool, CancellationToken)
Writes the provided value
to the coil registers.
public Task WriteSingleCoilAsync(int unitIdentifier, int registerAddress, bool value, CancellationToken cancellationToken = default)
Parameters
unitIdentifier
intThe unit identifier is used to communicate via devices such as bridges, routers and gateways that use a single IP address to support multiple independent Modbus end units. Thus, the unit identifier is the address of a remote slave connected on a serial line or on other buses. Use the default values 0x00 or 0xFF when communicating to a Modbus server that is directly connected to a TCP/IP network.
registerAddress
intThe coil address for the write operation.
value
boolThe value to write to the server.
cancellationToken
CancellationToken The token to monitor for cancellation requests. The default value is None.
Returns
WriteSingleRegister(byte, ushort, byte[])
Low level API. Use the overloads of this method for easier access. Writes the provided byte array to the holding register.
Parameters
unitIdentifier
byteThe unit identifier is used to communicate via devices such as bridges, routers and gateways that use a single IP address to support multiple independent Modbus end units. Thus, the unit identifier is the address of a remote slave connected on a serial line or on other buses. Use the default values 0x00 or 0xFF when communicating to a Modbus server that is directly connected to a TCP/IP network.
registerAddress
ushortThe holding register address for the write operation.
value
byte[]The value to write to the server, which is passed as a 2-byte array.
WriteSingleRegister(int, int, short)
Writes the provided value
to the holding registers.
Parameters
unitIdentifier
intThe unit identifier is used to communicate via devices such as bridges, routers and gateways that use a single IP address to support multiple independent Modbus end units. Thus, the unit identifier is the address of a remote slave connected on a serial line or on other buses. Use the default values 0x00 or 0xFF when communicating to a Modbus server that is directly connected to a TCP/IP network.
registerAddress
intThe holding register address for the write operation.
value
shortThe value to write to the server.
WriteSingleRegister(int, int, ushort)
Writes the provided value
to the holding registers.
Parameters
unitIdentifier
intThe unit identifier is used to communicate via devices such as bridges, routers and gateways that use a single IP address to support multiple independent Modbus end units. Thus, the unit identifier is the address of a remote slave connected on a serial line or on other buses. Use the default values 0x00 or 0xFF when communicating to a Modbus server that is directly connected to a TCP/IP network.
registerAddress
intThe holding register address for the write operation.
value
ushortThe value to write to the server.
WriteSingleRegisterAsync(byte, ushort, byte[], CancellationToken)
Low level API. Use the overloads of this method for easier access. Writes the provided byte array to the holding register.
public Task WriteSingleRegisterAsync(byte unitIdentifier, ushort registerAddress, byte[] value, CancellationToken cancellationToken = default)
Parameters
unitIdentifier
byteThe unit identifier is used to communicate via devices such as bridges, routers and gateways that use a single IP address to support multiple independent Modbus end units. Thus, the unit identifier is the address of a remote slave connected on a serial line or on other buses. Use the default values 0x00 or 0xFF when communicating to a Modbus server that is directly connected to a TCP/IP network.
registerAddress
ushortThe holding register address for the write operation.
value
byte[]The value to write to the server, which is passed as a 2-byte array.
cancellationToken
CancellationToken The token to monitor for cancellation requests. The default value is None.
Returns
WriteSingleRegisterAsync(int, int, short, CancellationToken)
Writes the provided value
to the holding registers.
public Task WriteSingleRegisterAsync(int unitIdentifier, int registerAddress, short value, CancellationToken cancellationToken = default)
Parameters
unitIdentifier
intThe unit identifier is used to communicate via devices such as bridges, routers and gateways that use a single IP address to support multiple independent Modbus end units. Thus, the unit identifier is the address of a remote slave connected on a serial line or on other buses. Use the default values 0x00 or 0xFF when communicating to a Modbus server that is directly connected to a TCP/IP network.
registerAddress
intThe holding register address for the write operation.
value
shortThe value to write to the server.
cancellationToken
CancellationToken The token to monitor for cancellation requests. The default value is None.
Returns
WriteSingleRegisterAsync(int, int, ushort, CancellationToken)
Writes the provided value
to the holding registers.
public Task WriteSingleRegisterAsync(int unitIdentifier, int registerAddress, ushort value, CancellationToken cancellationToken = default)
Parameters
unitIdentifier
intThe unit identifier is used to communicate via devices such as bridges, routers and gateways that use a single IP address to support multiple independent Modbus end units. Thus, the unit identifier is the address of a remote slave connected on a serial line or on other buses. Use the default values 0x00 or 0xFF when communicating to a Modbus server that is directly connected to a TCP/IP network.
registerAddress
intThe holding register address for the write operation.
value
ushortThe value to write to the server.
cancellationToken
CancellationToken The token to monitor for cancellation requests. The default value is None.