GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  MODBUS_SET_ERROR_RECOVERY (3)

.ds Aq ’

NAME

modbus_set_error_recovery - set the error recovery mode

CONTENTS

SYNOPSIS

int modbus_set_error_recovery(modbus_t *ctx, modbus_error_recovery_mode error_recovery);

DESCRIPTION

The modbus_set_error_recovery() function shall set the error recovery mode to apply when the connection fails or the byte received is not expected. The argument error_recovery may be bitwise-or\(cqed with zero or more of the following constants.

By default there is no error recovery (MODBUS_ERROR_RECOVERY_NONE) so the application is responsible for controlling the error values returned by libmodbus functions and for handling them if necessary.

When MODBUS_ERROR_RECOVERY_LINK is set, the library will attempt an reconnection after a delay defined by response timeout of the libmodbus context. This mode will try a infinite close/connect loop until success on send call and will just try one time to retablish the connection on select/read calls (if the connecton was down, the values to read are certainly not available anymore after reconnection, except for slave/server). This mode will also run flush requests after a delay based on the current response timeout in some situations (eg. timeout of select call). The reconnection attempt can hang for several seconds if the network to the remote target unit is down.

When MODBUS_ERROR_RECOVERY_PROTOCOL is set, a sleep and flush sequence will be used to cleanup the ongoing communication, this can occurs when the message length is invalid, the TID is wrong or the received function code is not the expected one. The response timeout delay will be used to sleep.

The modes are mask values and so they are complementary.

It\(cqs not recommended to enable error recovery for slave/server.

RETURN VALUE

The modbus_set_error_recovery() function shall return 0 if successful. Otherwise it shall return -1 and set errno to one of the values defined below.

ERRORS

EINVAL

The value of the argument error_recovery is not positive.

EXAMPLE

modbus_set_error_recovery(ctx,
                          MODBUS_ERROR_RECOVERY_LINK |
                          MODBUS_ERROR_RECOVERY_PROTOCOL);

AUTHORS

The libmodbus documentation was written by St\(&#146;ephane Raimbault <\m[blue]stephane.raimbault@gmail.com\m[][1]>

NOTES

1. stephane.raimbault@gmail.com  mailto:stephane.raimbault@gmail.com
Search for    or go to Top of page |  Section 3 |  Main Index


libmodbus 3&.1&.0 MODBUS_SET_ERROR_REC (3) 10/06/2013

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.