Function
Connects to a Modbus slave device.
Format
ret = modbus_connect( modbus_t *'ctx' );
Parameters
ctx [ C : modbus_t * ] [ Python : ctypes.POINTER(modbus_t) ]
Specify the pointer to the libmodbus structure.
Return values
ret [ C : int ] [ Python : ctypes.c_int ]
If the function succeeds, 0 is returned. If the function fails, -1 is returned.
Remarks
Connects to a Modbus slave device. Please use this function after making settings related to communication with modbus_new_tcp or modbus_new_rtu.
Example
Connects to the Modbus slave according to the structure specified by ctx.
C |
int ret; modbus_t *ctx; ret = modbus_connect(ctx);
|
Python |
ret = ctypes.c_int ctx = ctypes.POINTER(modbus_t) ret = modbus.modbus_connect(ctx)
|