<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Master and sockets control]]></title><description><![CDATA[<p dir="auto">Hello.<br />
When I run the next code I can see that the master.getValue(el), send the message to the server to close the socket.<br />
In the attached whireshark picture you can see it. In the whireshark picture the 192.168.2.101 is the controller (modbus tcp server) and the 192.168.2.69 is my computer.<br />
In this moment I have problems reading values every 500ms from one controller because every time that I read the master.getValue close the socket.</p>
<p dir="auto">Do you know How can we close the socket only at the end of the readings?</p>
<p dir="auto">Thanks.</p>
<pre><code>
 NumericLocator el = new NumericLocator(255, RegisterRange.HOLDING_REGISTER, 0, DataType.TWO_BYTE_INT_UNSIGNED);
        NumericLocator fjk = new NumericLocator(255, RegisterRange.HOLDING_REGISTER, 1, DataType.TWO_BYTE_INT_UNSIGNED);

        for (int i = 0; i &lt; 1113; i++) {
            try {
                System.out.println("el: " + master.getValue(el));
                System.out.println("fjk: " + master.getValue(fjk));
            }
            catch (Exception e) {
                e.printStackTrace();
            }
        }

</code></pre>
<p dir="auto">Attachment: <a href="http://archive.infiniteautomation.com/forum/posts/downloadAttach/343.page" rel="nofollow ugc">download link</a></p>
]]></description><link>https://forum.mango-os.com/topic/1663/master-and-sockets-control</link><generator>RSS for Node</generator><lastBuildDate>Wed, 14 Oct 2026 13:06:53 GMT</lastBuildDate><atom:link href="https://forum.mango-os.com/topic/1663.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 13 Aug 2014 19:09:20 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Master and sockets control on Sat, 16 Aug 2014 20:59:55 GMT]]></title><description><![CDATA[<p dir="auto">The problem is solved.<br />
When we create the master we can see a paramer keepalive in the constructor.</p>
<p dir="auto">ModbusMaster master = modbusFactory.createTcpMaster(ipParameters, keepalive);</p>
<p dir="auto">I was keepalive=false. If keepalive = false then every time that the client (master) read of the server (slave) the socket is open------close.</p>
<p dir="auto">If keepalive = true then the master close the socket at the end of all the readings. But I do not know how the keepalive works exactly, is it parametrizable...</p>
<p dir="auto"><strong>Do you know How the keepalive works exactly? And Where Can I find Modbus4j documentation?</strong></p>
<p dir="auto">Best regards.</p>
]]></description><link>https://forum.mango-os.com/post/9128</link><guid isPermaLink="true">https://forum.mango-os.com/post/9128</guid><dc:creator><![CDATA[ramonhl]]></dc:creator><pubDate>Sat, 16 Aug 2014 20:59:55 GMT</pubDate></item></channel></rss>