<?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[IdTCPClient lesen in Thread]]></title><description><![CDATA[<p>Hallo zusammen<br />
Ich benutze für mein Applikation die IdTCPClient-Komponente.</p>
<p>Das Lesen habe ich über einen Thread gelöst.</p>
<pre><code class="language-cpp">void __fastcall TForm1::IdTCPClient1Connected(TObject *Sender)
{
   ReadThread = new TTCPRead(false,this);
}

void __fastcall TForm1::IdTCPClient1Disconnected(TObject *Sender)
{
      if(ReadThread)
         ReadThread-&gt;Terminate();
}
</code></pre>
<p>im Thread lese ich so die Daten aus:</p>
<pre><code class="language-cpp">void __fastcall TTCPRead::Execute()
{     
   FreeOnTerminate = true;
   unsigned char Byte;
   while(!Terminated)
   {      
      StreamPack = new TStringStream(MainForm-&gt;IdTCPClient1-&gt;CurrentReadBuffer());

      ....
      ....

      Synchronize(ReadPacket);
      delete StreamPack;
   }
}
</code></pre>
<p>Jetzt tritt bei jedem Disconnect ein EIdSocketError-Exception auf(Socket-Operation auf Nicht-Socket).<br />
Wenn ich das richtige verstehe liegts daran dass</p>
<pre><code class="language-cpp">StreamPack = new TStringStream(MainForm-&gt;IdTCPClient1-&gt;CurrentReadBuffer());
</code></pre>
<p>noch auf die Daten wartet.</p>
<p>gibt es Möglichkeiten das zu beheben?</p>
<p>schonmal danke im voraus für jegliche tipps</p>
<p>BigNeal :xmas2:</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/130721/idtcpclient-lesen-in-thread</link><generator>RSS for Node</generator><lastBuildDate>Thu, 30 Jul 2026 06:13:36 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/130721.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 26 Dec 2005 15:37:48 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to IdTCPClient lesen in Thread on Mon, 26 Dec 2005 15:37:48 GMT]]></title><description><![CDATA[<p>Hallo zusammen<br />
Ich benutze für mein Applikation die IdTCPClient-Komponente.</p>
<p>Das Lesen habe ich über einen Thread gelöst.</p>
<pre><code class="language-cpp">void __fastcall TForm1::IdTCPClient1Connected(TObject *Sender)
{
   ReadThread = new TTCPRead(false,this);
}

void __fastcall TForm1::IdTCPClient1Disconnected(TObject *Sender)
{
      if(ReadThread)
         ReadThread-&gt;Terminate();
}
</code></pre>
<p>im Thread lese ich so die Daten aus:</p>
<pre><code class="language-cpp">void __fastcall TTCPRead::Execute()
{     
   FreeOnTerminate = true;
   unsigned char Byte;
   while(!Terminated)
   {      
      StreamPack = new TStringStream(MainForm-&gt;IdTCPClient1-&gt;CurrentReadBuffer());

      ....
      ....

      Synchronize(ReadPacket);
      delete StreamPack;
   }
}
</code></pre>
<p>Jetzt tritt bei jedem Disconnect ein EIdSocketError-Exception auf(Socket-Operation auf Nicht-Socket).<br />
Wenn ich das richtige verstehe liegts daran dass</p>
<pre><code class="language-cpp">StreamPack = new TStringStream(MainForm-&gt;IdTCPClient1-&gt;CurrentReadBuffer());
</code></pre>
<p>noch auf die Daten wartet.</p>
<p>gibt es Möglichkeiten das zu beheben?</p>
<p>schonmal danke im voraus für jegliche tipps</p>
<p>BigNeal :xmas2:</p>
]]></description><link>https://www.c-plusplus.net/forum/post/950258</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/950258</guid><dc:creator><![CDATA[BigNeal]]></dc:creator><pubDate>Mon, 26 Dec 2005 15:37:48 GMT</pubDate></item></channel></rss>