<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- qmodbustcpserver.cpp --> <title>QModbusTcpServer Class | Qt Serial Bus 5.9</title> <link rel="stylesheet" type="text/css" href="style/offline-simple.css" /> <script type="text/javascript"> document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css"); // loading style sheet breaks anchors that were jumped to before // so force jumping to anchor again setTimeout(function() { var anchor = location.hash; // need to jump to different anchor first (e.g. none) location.hash = "#"; setTimeout(function() { location.hash = anchor; }, 0); }, 0); </script> </head> <body> <div class="header" id="qtdocheader"> <div class="main"> <div class="main-rounded"> <div class="navigationbar"> <table><tr> <td >Qt 5.9</td><td ><a href="qtserialbus-index.html">Qt Serial Bus</a></td><td ><a href="qtserialbus-module.html">C++ Classes</a></td><td >QModbusTcpServer</td></tr></table><table class="buildversion"><tr> <td id="buildversion" width="100%" align="right">Qt 5.9.4 Reference Documentation</td> </tr></table> </div> </div> <div class="content"> <div class="line"> <div class="content mainContent"> <div class="sidebar"> <div class="toc"> <h3><a name="toc">Contents</a></h3> <ul> <li class="level1"><a href="#public-functions">Public Functions</a></li> <li class="level1"><a href="#reimplemented-protected-functions">Reimplemented Protected Functions</a></li> <li class="level1"><a href="#details">Detailed Description</a></li> </ul> </div> <div class="sidebar-content" id="sidebar-content"></div></div> <h1 class="title">QModbusTcpServer Class</h1> <!-- $$$QModbusTcpServer-brief --> <p>The <a href="qmodbustcpserver.html">QModbusTcpServer</a> class represents a Modbus server that uses a TCP server for its communication with the Modbus client. <a href="#details">More...</a></p> <!-- @@@QModbusTcpServer --> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> <span class="preprocessor">#include <QModbusTcpServer></span> </td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += serialbus</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Since:</td><td class="memItemRight bottomAlign"> Qt 5.8</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherits:</td><td class="memItemRight bottomAlign"> <a href="qmodbusserver.html">QModbusServer</a></td></tr></table></div><ul> <li><a href="qmodbustcpserver-members.html">List of all members, including inherited members</a></li> </ul> <a name="public-functions"></a> <h2 id="public-functions">Public Functions</h2> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qmodbustcpserver.html#QModbusTcpServer">QModbusTcpServer</a></b>(QObject *<i>parent</i> = nullptr)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qmodbustcpserver.html#dtor.QModbusTcpServer">~QModbusTcpServer</a></b>()</td></tr> </table></div> <ul> <li class="fn">10 public functions inherited from <a href="qmodbusserver.html#public-functions">QModbusServer</a></li> <li class="fn">7 public functions inherited from <a href="qmodbusdevice.html#public-functions">QModbusDevice</a></li> </ul> <a name="reimplemented-protected-functions"></a> <h2 id="reimplemented-protected-functions">Reimplemented Protected Functions</h2> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qmodbustcpserver.html#close">close</a></b>() override</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qmodbustcpserver.html#open">open</a></b>() override</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual QModbusResponse </td><td class="memItemRight bottomAlign"><b><a href="qmodbustcpserver.html#processRequest">processRequest</a></b>(const QModbusPdu &<i>request</i>) override</td></tr> </table></div> <ul> <li class="fn">4 protected functions inherited from <a href="qmodbusserver.html#protected-functions">QModbusServer</a></li> <li class="fn">4 protected functions inherited from <a href="qmodbusdevice.html#protected-functions">QModbusDevice</a></li> </ul> <h3>Additional Inherited Members</h3> <ul> <li class="fn">1 signal inherited from <a href="qmodbusserver.html#signals">QModbusServer</a></li> <li class="fn">2 signals inherited from <a href="qmodbusdevice.html#signals">QModbusDevice</a></li> <li class="fn">4 protected functions inherited from <a href="qmodbusserver.html#protected-functions">QModbusServer</a></li> <li class="fn">4 protected functions inherited from <a href="qmodbusdevice.html#protected-functions">QModbusDevice</a></li> </ul> <a name="details"></a> <!-- $$$QModbusTcpServer-description --> <div class="descr"> <h2 id="details">Detailed Description</h2> <p>The <a href="qmodbustcpserver.html">QModbusTcpServer</a> class represents a Modbus server that uses a TCP server for its communication with the Modbus client.</p> <p>Communication via Modbus requires the interaction between a single Modbus client instance and single Modbus server. This class provides the Modbus server implementation via a TCP server.</p> <p>Modbus TCP networks can have multiple servers. Servers are read/written by a client device represented by <a href="qmodbustcpclient.html">QModbusTcpClient</a>.</p> </div> <!-- @@@QModbusTcpServer --> <div class="func"> <h2>Member Function Documentation</h2> <!-- $$$QModbusTcpServer[overload1]$$$QModbusTcpServerQObject* --> <h3 class="fn" id="QModbusTcpServer"><a name="QModbusTcpServer"></a>QModbusTcpServer::<span class="name">QModbusTcpServer</span>(<span class="type">QObject</span> *<i>parent</i> = nullptr)</h3> <p>Constructs a <a href="qmodbustcpserver.html">QModbusTcpServer</a> with the specified <i>parent</i>. The <a href="qmodbusserver.html#serverAddress">serverAddress</a> preset is <code>255</code>.</p> <!-- @@@QModbusTcpServer --> <!-- $$$~QModbusTcpServer[overload1]$$$~QModbusTcpServer --> <h3 class="fn" id="dtor.QModbusTcpServer"><a name="dtor.QModbusTcpServer"></a>QModbusTcpServer::<span class="name">~QModbusTcpServer</span>()</h3> <p>Destroys the <a href="qmodbustcpserver.html">QModbusTcpServer</a> instance.</p> <!-- @@@~QModbusTcpServer --> <!-- $$$close[overload1]$$$close --> <h3 class="fn" id="close"><a name="close"></a><code>[override virtual protected] </code><span class="type">void</span> QModbusTcpServer::<span class="name">close</span>()</h3> <p>Reimplemented from <a href="qmodbusdevice.html#close">QModbusDevice::close</a>().</p> <!-- @@@close --> <!-- $$$open[overload1]$$$open --> <h3 class="fn" id="open"><a name="open"></a><code>[override virtual protected] </code><span class="type">bool</span> QModbusTcpServer::<span class="name">open</span>()</h3> <p>Reimplemented from <a href="qmodbusdevice.html#open">QModbusDevice::open</a>().</p> <!-- @@@open --> <!-- $$$processRequest[overload1]$$$processRequestconstQModbusPdu& --> <h3 class="fn" id="processRequest"><a name="processRequest"></a><code>[override virtual protected] </code><span class="type"><a href="qmodbusresponse.html">QModbusResponse</a></span> QModbusTcpServer::<span class="name">processRequest</span>(const <span class="type"><a href="qmodbuspdu.html">QModbusPdu</a></span> &<i>request</i>)</h3> <p>Reimplemented from <a href="qmodbusserver.html#processRequest">QModbusServer::processRequest</a>().</p> <p>Processes the Modbus client request specified by <i>request</i> and returns a Modbus response.</p> <p>The following Modbus function codes are filtered out as they are serial line only according to the Modbus Application Protocol Specification 1.1b:</p> <ul> <li><a href="qmodbuspdu.html#FunctionCode-enum">QModbusRequest::ReadExceptionStatus</a></li> <li><a href="qmodbuspdu.html#FunctionCode-enum">QModbusRequest::Diagnostics</a></li> <li><a href="qmodbuspdu.html#FunctionCode-enum">QModbusRequest::GetCommEventCounter</a></li> <li><a href="qmodbuspdu.html#FunctionCode-enum">QModbusRequest::GetCommEventLog</a></li> <li><a href="qmodbuspdu.html#FunctionCode-enum">QModbusRequest::ReportServerId</a></li> </ul> <p>A request to the TCP server will be answered with a Modbus exception response with the exception code <a href="qmodbuspdu.html#ExceptionCode-enum">QModbusExceptionResponse::IllegalFunction</a>.</p> <!-- @@@processRequest --> </div> </div> </div> </div> </div> </div> <div class="footer"> <p> <acronym title="Copyright">©</acronym> 2017 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners.<br> The documentation provided herein is licensed under the terms of the <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation License version 1.3</a> as published by the Free Software Foundation.<br> Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners. </p> </div> </body> </html>