Xentara Modbus Driver v1.0
User Manual
Modbus Driver Error Numbers

a Xentara Modbus driver error number of 0 indicates success. The other error number are divided into three separate ranges, described below.

Native Operating System Error Codes (0 to 999,999,999)

If an operating system function fails, the Xentara Modbus driver error number is simply the native error code used by the operating system.


man pages
errno(1), errno(3)

If the modbus server is being serviced from a Linux machine, the native error codes are standard errno error codes. Some important errors you may encounter are the following:

Code Name Meaning
2 ENOENT No such file or directory
13 EACCES Permission denied
19 ENODEV No such device
100 ENETDOWN Network is down
101 ENETUNREACH Network is unreachable
104 ECONNRESET Connection reset by peer
110 ETIMEDOUT Connection timed out
111 ECONNREFUSED Connection refused
112 EHOSTDOWN Host is down
113 EHOSTUNREACH No route to host

A more exhaustive list of standard Linux error codes can be found here:

Appendix A: Standard Linux Error Codes

The meaning of an error code can also be queried using the Linux errno command line utility. To look up the meaning of error code 113, you can use the following command, for example:

errno 113

This will print:

EHOSTUNREACH 113 No route to host

On Debian and Ubuntu, the errno command is not installed by default. Thus use the errno command, you need to install the system package moreutils. To install moreutils, use the following command:

sudo apt-get install moreutils
The user executing this command will need special privileges to be able to use sudo . This is usually accomplished by adding the user to the sudo user group. This can only be done by the root user, or by another user that already has sudo access.


See also
System Error Codes in the Windows technical documentation at docs.microsoft.com.

If the modbus server is being serviced from a Windows machine, the native error codes are Windows system error codes. The Windows system error codes are listed here:

System Error Codes (0-499)
System Error Codes (1000-1299)
System Error Codes (1300-1699)
System Error Codes (1700-3999)
System Error Codes (4000-5999)
System Error Codes (6000-8199)
System Error Codes (8200-8999)
System Error Codes (9000-11999)
System Error Codes (12000-15999)

Modbus Exceptions (1,000,000,000 to 1,999,999,999)

If a modbus server or gateway returns one of the Modbus exceptions defined in the Modbus specification, the Xentara Modbus driver error number is based on the Modbus exception code. To distuguish Modbus exceptions from native operating system errors, the Modbus driver adds 4,000,000,000 to the Modbus exception code. The following table shown the Xentara Modbus driver error numbers that correspond to Modbus exceptions:

Xentara Error Number Modbus Exception Code Modbus Exception Name Meaning
1,000,000,001 01 ILLEGAL FUNCTION Illegal function
1,000,000,002 02 ILLEGAL DATA ADDRESS Illegal data address
1,000,000,003 03 ILLEGAL DATA VALUE Illegal data value
1,000,000,004 04 SLAVE DEVICE FAILURE Slave device or server failure
1,000,000,005 05 ACKNOWLEDGE Acknowledge
1,000,000,006 06 SLAVE DEVICE BUSY Slave device or server is busy
1,000,000,007 07 NEGATIVE ACKNOWLEDGE Negative acknowledge
1,000,000,008 08 MEMORY PARITY ERROR Memory parity error
1,000,000,010 0A GATEWAY PATH UNAVAILABLE Gateway path unavailable
1,000,000,011 0B GATEWAY TARGET DEVICE FAILED TO RESPOND Target device failed to respond

Modbus Exception Code 09 (1,000,000,009) is not assigned in the Modbus specification.

The modbus exception codes are described in greater details in the MODBUS Protocol Specification, available under Modbus Specifications and Implementation Guides at modbus.org.

Custom Error Numbers (2,000,000,000 to 2,999,999,999)

The Xentara Modbus driver also defines the following additional error numbers:

Error Number Meaning
2,000,000,001 Not connected to the Modbus server
2,000,000,002 No response received from Modbus server
2,000,000,003 Corrupt Modbus message received (CRC check failed)
2,000,000,005 Invalid Modbus message
2,000,000,006 Unrecognized Modbus exception code
2,000,000,007 Modbus message data too long
2,000,000,008 Response contains wrong Modbus server ID
2,000,000,999 Catch-all error code for miscellaneous errors that do not have their own error codes

Address Resolution Errors (3,000,000,000 to 3,999,999,999) (Linux only)

man pages

Linux uses special error codes when trying to resolve host names and network addresses. These address resolution error codes are negative values, but Xentara maps them to positive error numbers. The Modbus driver uses the following calculation for Linus address resultion errors:

Xentara Error Number = 3,000,000,000 − native error code

Usually, the only address resolution error the Modbus driver will report, is 3,000,000,002 (EAI_NONAME). This error means that the host name could not be found.

The complete list of Linux address resolution error codes can be found here:

Appendix B: Linux Address Resolution Error Codes