'\" t .\" Title: modbus_reply .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.78.1 .\" Date: 10/18/2014 .\" Manual: Libmodbus Manual .\" Source: libmodbus 3.0.6 .\" Language: English .\" .TH "MODBUS_REPLY" "3" "10/18/2014" "libmodbus 3\&.0\&.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 reponse 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 \fImodbus_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 \fImodbus_reply()\fR function shall return the length of the response sent if successful\&. Otherwise it shall return \-1 and set errno\&. .SH "ERRORS" .PP EMBMDATA .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\('ephane Raimbault <\m[blue]\fBstephane\&.raimbault@gmail\&.com\fR\m[]\&\s-2\u[1]\d\s+2> .SH "NOTES" .IP " 1." 4 stephane.raimbault@gmail.com .RS 4 \%mailto:stephane.raimbault@gmail.com .RE