Function
Retrieves the response timeout period in Modbus communication.
Format
ret = modbus_get_response_timeout( ctx , to_sec , to_usec )
Parameters
ctx [ VB.NET: IntPtr ] [ C, C++: modbus_t * ] [ C#: IntPtr ] [ Python:ctypes.POINTER(modbus_t) ]
Specify the pointer to the libmodbus structure.
to_sec [ VB.NET:ByRef Uinteger ] [ C, C++: uint32_t * ] [ C#: out uint() ] [ Python: ctypes.POINTER(ctypes.c_uint32) ]
Specify the pointer to store the part of the timeout period that is more than 1 second (in unit of sec).
to_usec [ VB.NET:Uinteger ] [ C, C++: uint32_t * ] [ C#:out uint ] [ Python: ctypes.POINTER(ctypes.c_uint32) ]
Specify the pointer to store the part of the timeout period that is less than 1 second (in unit of usec).
Return values
ret [ VB.NET:Integer ] [ C, C++: int ] [ C#: int ] [ Python: ctypes.c_int ]
If the function succeeds, 0 is returned. If the function fails, -1 is returned, and the following errno is set.
Definition |
Description |
EINVAL |
CTX is invalid. |
Remarks
Retrieves the response timeout period in Modbus communication.
Example
Retrieves the timeout period.
VB.NET |
Dim ret As Integer Dim ctx As IntPtr Dim to_sec UInteger Dim to_usec UInteger ret = modbus_get_response_timeout(ctx,to_sec,to_usec )
|
C, C++ |
int Ret; modbus_t *ctx; uint32_t to_sec; uint32_t to_usec; Ret = modbus_get_response_timeout(ctx, &to_sec, &to_usec);
|
C# |
int ret; IntPtr ctx; uint to_sec; uint to_usec; ret = modbus_get_response_timeout(ctx, out sec, out to_usec);
|
Python |
ret = ctypes.c_int ctx = ctypes.POINTER(modbus_t) uint32_to_sec = ctypes.c_ulong uint32_to_usec = ctypes.c_ulong ret = modbus.modbus_get_response_timeout(ctx, sec, to_usec) |