'\" t
.\" Title: modbus_reply
.\" Author: [see the "AUTHORS" section]
.\" Generator: DocBook XSL Stylesheets v1.79.1
.\" Date: 02/28/2020
.\" Manual: libmodbus Manual
.\" Source: libmodbus v3.1.6
.\" Language: English
.\"
.TH "MODBUS_REPLY" "3" "02/28/2020" "libmodbus v3\&.1\&.6" "libmodbus Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
modbus_reply \- send a response to the received request
.SH "SYNOPSIS"
.sp
*int modbus_reply(modbus_t *\fIctx\fR, const uint8_t *\fIreq\fR, int \fIreq_length\fR, modbus_mapping_t *\fImb_mapping\fR);
.SH "DESCRIPTION"
.sp
The \fBmodbus_reply()\fR function shall send a response to received request\&. The request \fIreq\fR given in argument is analyzed, a response is then built and sent by using the information of the modbus context \fIctx\fR\&.
.sp
If the request indicates to read or write a value the operation will done in the modbus mapping \fImb_mapping\fR according to the type of the manipulated data\&.
.sp
If an error occurs, an exception response will be sent\&.
.sp
This function is designed for Modbus server\&.
.SH "RETURN VALUE"
.sp
The function shall return the length of the response sent if successful\&. Otherwise it shall return \-1 and set errno\&.
.SH "ERRORS"
.PP
\fBEMBMDATA\fR
.RS 4
Sending has failed
.RE
.sp
See also the errors returned by the syscall used to send the response (eg\&. send or write)\&.
.SH "SEE ALSO"
.sp
\fBmodbus_reply_exception\fR(3) \fBlibmodbus\fR(7)
.SH "AUTHORS"
.sp
The libmodbus documentation was written by Stéphane Raimbault