<?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[Wanted to connect to PLC through ethernet but its not getting connected giving error device not open]]></title><description><![CDATA[<p dir="auto">Re: <a href="/topic/83988/qt-gui-c-to-read-other-controllers-memory-location-through-ethernet-tcp-ip-address">Qt gui C++ to read other controllers memory location through ethernet tcp/ip address</a><br />
Wanted to connect to PLC through ethernet in Qt but its not getting connected giving error device not open.<br />
but when connected through other means like using hercules the plc gets connected.</p>
<p dir="auto">giving error :<br />
<em><strong>QIODevice::write (QTcpSocket): device not open</strong></em></p>
<p dir="auto">program:</p>
<p dir="auto">***clientnetworksocket=new QTcpSocket(this);<br />
clientnetworksocket-&gt;connectToHost(QHostAddress("192.168.5.239"),5102,QIODevice::ReadWrite);<br />
if (clientnetworksocket-&gt;waitForConnected(2000))<br />
{<br />
ui-&gt;label_status-&gt;setText("Connected to Server");</p>
<pre><code> }
 else
 {
     ui-&gt;label_status-&gt;setText("Server Offline");
   clientnetworksocket-&gt;disconnectFromHost();
   clientnetworksocket-&gt;close();
 }


 connect(timer, SIGNAL(timeout()), this, SLOT(monitorLoop()));
 timer-&gt;start(500);

 connect(clientnetworksocket,SIGNAL(readyRead()),this, SLOT(serialDataReceived()));
</code></pre>
<p dir="auto">connect(clientnetworksocket,SIGNAL(disconnected()),this,SLOT(lineStatus()));***</p>
]]></description><link>https://forum.qt.io/topic/127553/wanted-to-connect-to-plc-through-ethernet-but-its-not-getting-connected-giving-error-device-not-open</link><generator>RSS for Node</generator><lastBuildDate>Sat, 18 Apr 2026 00:40:16 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/127553.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 14 Jun 2021 11:53:17 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Wanted to connect to PLC through ethernet but its not getting connected giving error device not open on Wed, 16 Jun 2021 06:25:18 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mganesh">@<bdi>mganesh</bdi></a> Is the IP correct? Is the port correct? Did you try to disable the firewall?<br />
Also, you know that QTcpSocket provides functionality to get information about occurred errors? Why don't you use it?<br />
So please check what <a href="https://doc.qt.io/qt-5/qabstractsocket.html#error" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qt-5/qabstractsocket.html#error</a> and <a href="https://doc.qt.io/qt-5/qiodevice.html#errorString" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qt-5/qiodevice.html#errorString</a> tell you after connection timeout...</p>
]]></description><link>https://forum.qt.io/post/665380</link><guid isPermaLink="true">https://forum.qt.io/post/665380</guid><dc:creator><![CDATA[jsulm]]></dc:creator><pubDate>Wed, 16 Jun 2021 06:25:18 GMT</pubDate></item><item><title><![CDATA[Reply to Wanted to connect to PLC through ethernet but its not getting connected giving error device not open on Wed, 16 Jun 2021 06:20:52 GMT]]></title><description><![CDATA[<p dir="auto">no ..plz help to to connect to PLC</p>
]]></description><link>https://forum.qt.io/post/665377</link><guid isPermaLink="true">https://forum.qt.io/post/665377</guid><dc:creator><![CDATA[mganesh]]></dc:creator><pubDate>Wed, 16 Jun 2021 06:20:52 GMT</pubDate></item><item><title><![CDATA[Reply to Wanted to connect to PLC through ethernet but its not getting connected giving error device not open on Mon, 14 Jun 2021 12:20:57 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mganesh">@<bdi>mganesh</bdi></a> So, did the connection succeed?</p>
]]></description><link>https://forum.qt.io/post/664943</link><guid isPermaLink="true">https://forum.qt.io/post/664943</guid><dc:creator><![CDATA[jsulm]]></dc:creator><pubDate>Mon, 14 Jun 2021 12:20:57 GMT</pubDate></item><item><title><![CDATA[Reply to Wanted to connect to PLC through ethernet but its not getting connected giving error device not open on Mon, 14 Jun 2021 12:17:36 GMT]]></title><description><![CDATA[<p dir="auto">part of program:</p>
<p dir="auto">***QByteArray data_to_transmit = QByteArray::fromHex(networkmonitorCommand);</p>
<pre><code>    qDebug()&lt;&lt;networkmonitorCommand;

        clientnetworksocket-&gt;write(data_to_transmit);
         clientnetworksocket-&gt;flush();***
</code></pre>
]]></description><link>https://forum.qt.io/post/664942</link><guid isPermaLink="true">https://forum.qt.io/post/664942</guid><dc:creator><![CDATA[mganesh]]></dc:creator><pubDate>Mon, 14 Jun 2021 12:17:36 GMT</pubDate></item><item><title><![CDATA[Reply to Wanted to connect to PLC through ethernet but its not getting connected giving error device not open on Mon, 14 Jun 2021 12:10:53 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mganesh">@<bdi>mganesh</bdi></a> said in <a href="/post/664935">Wanted to connect to PLC through ethernet but its not getting connected giving error device not open</a>:</p>
<blockquote>
<p dir="auto">QIODevice::write (QTcpSocket): device not open</p>
</blockquote>
<p dir="auto">Where do you got this error?<br />
On you code extract, there is not write.</p>
]]></description><link>https://forum.qt.io/post/664940</link><guid isPermaLink="true">https://forum.qt.io/post/664940</guid><dc:creator><![CDATA[KroMignon]]></dc:creator><pubDate>Mon, 14 Jun 2021 12:10:53 GMT</pubDate></item><item><title><![CDATA[Reply to Wanted to connect to PLC through ethernet but its not getting connected giving error device not open on Mon, 14 Jun 2021 12:07:15 GMT]]></title><description><![CDATA[<p dir="auto">removed whats next then also giving same error.</p>
]]></description><link>https://forum.qt.io/post/664939</link><guid isPermaLink="true">https://forum.qt.io/post/664939</guid><dc:creator><![CDATA[mganesh]]></dc:creator><pubDate>Mon, 14 Jun 2021 12:07:15 GMT</pubDate></item><item><title><![CDATA[Reply to Wanted to connect to PLC through ethernet but its not getting connected giving error device not open on Mon, 14 Jun 2021 11:58:53 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mganesh">@<bdi>mganesh</bdi></a> said in <a href="/post/664935">Wanted to connect to PLC through ethernet but its not getting connected giving error device not open</a>:</p>
<blockquote>
<p dir="auto">clientnetworksocket-&gt;disconnectFromHost();</p>
</blockquote>
<p dir="auto">There is no need to disconnect if socket was not connected</p>
]]></description><link>https://forum.qt.io/post/664938</link><guid isPermaLink="true">https://forum.qt.io/post/664938</guid><dc:creator><![CDATA[jsulm]]></dc:creator><pubDate>Mon, 14 Jun 2021 11:58:53 GMT</pubDate></item></channel></rss>