<?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[TClientSocket + mehrere Dateien herunterladen?]]></title><description><![CDATA[<p>Hey @all,</p>
<p>das man mit TClientSocket eine Datei mit der GET Anweisung herunterladen kann ist klar. Aber wie kann ich beispielsweise mehrere Dateien herunterladen, den da scheitert es bei mir dauernd</p>
<p>Hier mal mein Source</p>
<pre><code class="language-cpp">void __fastcall TfrmMain::Button2Click(TObject *Sender) {
  try {
    frmNetwork-&gt;cbUseProxy-&gt;Checked = netopt-&gt;get_use_proxy();
    frmNetwork-&gt;tfProxyServer-&gt;Text = netopt-&gt;get_proxy_address().c_str();
    frmNetwork-&gt;tfProxyPort-&gt;Text = netopt-&gt;get_proxy_port().c_str();
    frmNetwork-&gt;tfProtocol-&gt;Text = netopt-&gt;get_protocol().c_str();
    frmNetwork-&gt;tfProtocolVersion-&gt;Text = netopt-&gt;get_protocol_version().c_str(); 
    frmNetwork-&gt;tfDownloadServer-&gt;Text = netopt-&gt;get_server_address().c_str();
    frmNetwork-&gt;tfDownloadPath-&gt;Text = netopt-&gt;get_server_path().c_str();
    frmNetwork-&gt;tfFilenameLayout-&gt;Text = netopt-&gt;get_filename_layout().c_str();

    string filename;
    int do_what = 0;
    if((cbDay1-&gt;ItemIndex &gt;= 0 &amp;&amp; cbMonth1-&gt;ItemIndex &gt;= 0 &amp;&amp; cbYear1-&gt;ItemIndex &gt;= 0) &amp;&amp;
       !(cbDay2-&gt;ItemIndex &gt;= 0 &amp;&amp; cbMonth2-&gt;ItemIndex &gt;= 0 &amp;&amp; cbYear2-&gt;ItemIndex &gt;= 0))
      do_what = 1;
    else if(!(cbDay1-&gt;ItemIndex &gt;= 0 &amp;&amp; cbMonth1-&gt;ItemIndex &gt;= 0 &amp;&amp; cbYear1-&gt;ItemIndex &gt;= 0) &amp;&amp;
            (cbDay2-&gt;ItemIndex &gt;= 0 &amp;&amp; cbMonth2-&gt;ItemIndex &gt;= 0 &amp;&amp; cbYear2-&gt;ItemIndex &gt;= 0))
      do_what = 2;
    else if((cbDay1-&gt;ItemIndex &gt;= 0 &amp;&amp; cbMonth1-&gt;ItemIndex &gt;= 0 &amp;&amp; cbYear1-&gt;ItemIndex &gt;= 0) &amp;&amp;
            (cbDay2-&gt;ItemIndex &gt;= 0 &amp;&amp; cbMonth2-&gt;ItemIndex &gt;= 0 &amp;&amp; cbYear2-&gt;ItemIndex &gt;= 0))
      do_what = 3;
    else
      throw GASException(&quot;You must define all fields in FROM, TO or BOTH!&quot;);

    bool day_zero = false;
    bool month_zero = false;
    switch(do_what) {
      case 1: this-&gt;year = cbYear1-&gt;ItemIndex + 1978;
              this-&gt;month = cbMonth1-&gt;ItemIndex + 1;
              this-&gt;day = cbDay1-&gt;ItemIndex + 1;
              if((cbDay1-&gt;ItemIndex + 1) &lt; 10)
                day_zero = true;
              if((cbMonth1-&gt;ItemIndex + 1) &lt; 10)
                month_zero = true;
              break;
      case 2: this-&gt;year = cbYear2-&gt;ItemIndex + 1978;
              this-&gt;month = cbMonth2-&gt;ItemIndex + 1;
              this-&gt;day = cbDay2-&gt;ItemIndex + 1;
              if((cbDay2-&gt;ItemIndex + 1) &lt; 10)
                day_zero = true;
              if((cbMonth2-&gt;ItemIndex + 1) &lt; 10)
                month_zero = true;
              break;
    }

    // building filename

    this-&gt;filename = netopt-&gt;parse_macros(netopt-&gt;get_filename_layout(), year, month, day);
    string tmpDir = this-&gt;directory;
    string tmpFilename;

    if(this-&gt;directory != &quot;&quot;) {
      check_for_slashes(tmpDir, false);
      check_for_bslashes(tmpDir, true);
      tmpFilename = tmpDir + this-&gt;filename;
    }

    // Datei am Server - Lokales Verzeichnis - Lokale Datei
    this-&gt;lfd.push_back(FileData(&quot;1.gif&quot;, this-&gt;directory, &quot;test1.gif&quot;));
    this-&gt;lfd.push_back(FileData(&quot;2.gif&quot;, this-&gt;directory, &quot;test2.gif&quot;));
    this-&gt;lfd.push_back(FileData(&quot;3.gif&quot;, this-&gt;directory, &quot;test3.gif&quot;));
    this-&gt;lfd.push_back(FileData(&quot;4.gif&quot;, this-&gt;directory, &quot;test4.gif&quot;));
    this-&gt;lfd.push_back(FileData(&quot;5.gif&quot;, this-&gt;directory, &quot;test5.gif&quot;));
    this-&gt;lfd.push_back(FileData(&quot;6.gif&quot;, this-&gt;directory, &quot;test6.gif&quot;));
    this-&gt;lfd.push_back(FileData(&quot;7.gif&quot;, this-&gt;directory, &quot;test7.gif&quot;));
    this-&gt;lfd.push_back(FileData(&quot;8.gif&quot;, this-&gt;directory, &quot;test8.gif&quot;));
    this-&gt;lfd.push_back(FileData(&quot;9.gif&quot;, this-&gt;directory, &quot;test9.gif&quot;));
    this-&gt;lfd.push_back(FileData(&quot;10.gif&quot;, this-&gt;directory, &quot;test10.gif&quot;));

//    lfd.push_back(FileData(this-&gt;filename, this-&gt;directory, tmpFilename));

    // Wird ein Proxy benutzt?
    if(netopt-&gt;get_use_proxy()) {
      ClientSocket1-&gt;Host = netopt-&gt;get_proxy_address().c_str();
      ClientSocket1-&gt;Port = StrToInt(netopt-&gt;get_proxy_port().c_str());
    }
    else if(!netopt-&gt;get_use_proxy()) {
      ClientSocket1-&gt;Host = netopt-&gt;get_server_address().c_str();
      ClientSocket1-&gt;Port = 80;
    }

    if(!ClientSocket1-&gt;Active) {
      ClientSocket1-&gt;Open();
      frmProgress-&gt;Bar-&gt;Max = lfd.size();
      frmProgress-&gt;Bar-&gt;Position = 0;
      frmProgress-&gt;Show();
    }

  }
  catch(GASException&amp; e) {
    Application-&gt;MessageBoxA(e.what(), e.error(), MB_OK); 
  }
}
//---------------------------------------------------------------------------

void __fastcall TfrmMain::ClientSocket1Connect(TObject *Sender, TCustomWinSocket *Socket) {
  unsigned int file_counter = lfd.size();
  for(lfdIter = lfd.begin(); lfdIter != lfd.end(); ++lfdIter) {
    file_counter-=1;
    this-&gt;file_id = file_counter;

    AnsiString progress_message;
    progress_message.cat_sprintf(&quot;%d/%d %s&quot;, lfd.size()-file_counter, lfd.size(), this-&gt;lfd[this-&gt;file_id].full_local_path.c_str());
    frmProgress-&gt;lDownloadFile-&gt;Caption = progress_message;

    AnsiString get_buffer;
    get_buffer.cat_sprintf(&quot;GET %s%s/%s/%s HTTP/%s \n\n&quot;, netopt-&gt;get_protocol().c_str(),
                                                          ClientSocket1-&gt;Host,
                                                          netopt-&gt;parse_macros(netopt-&gt;get_server_path(), year, month, day).c_str(),
                                                          this-&gt;lfd[this-&gt;file_id].server_file.c_str(),
                                                          netopt-&gt;get_protocol_version().c_str());
    memory = new TMemoryStream();
    found_gif = false;
    ClientSocket1-&gt;Socket-&gt;SendText(get_buffer);
    _sleep(2);
  }
}
//---------------------------------------------------------------------------

void __fastcall TfrmMain::ClientSocket1Read(TObject *Sender, TCustomWinSocket *Socket) {
  bool is_header = false;
  is_error = false;
  if(!found_gif) {
    AnsiString Response;
    int nBytes = ClientSocket1-&gt;Socket-&gt;ReceiveLength();
    BYTE *Buffer = new BYTE[nBytes];
    ClientSocket1-&gt;Socket-&gt;ReceiveBuf(Buffer, nBytes);
    for(int i=0; i&lt;nBytes; i++) {
      if((Buffer[i] == 'G' &amp;&amp; Buffer[i+1] == 'I' &amp;&amp; Buffer[i+2] == 'F') ||
         is_header) {
	is_header = true;
        BYTE *b = new BYTE[1];
        b[0] = Buffer[i];
	memory-&gt;Write(b, 1);
      }
      else if ((Buffer[i] == 'N' &amp;&amp; Buffer[i+1] == 'o' &amp;&amp; Buffer[i+2] == 't' &amp;&amp;
                Buffer[i+3] == ' ' &amp;&amp; Buffer[i+4] == 'F' &amp;&amp; Buffer[i+5] == 'o' &amp;&amp;
                Buffer[i+6] == 'u' &amp;&amp; Buffer[i+7] == 'n' &amp;&amp; Buffer[i+8] == 'd')) {
	is_header = true;
        is_error = true;
      }         
    }
    found_gif = true;
  }

  if(found_gif &amp;&amp; !is_error) {
    AnsiString Response;
    int nBytes = ClientSocket1-&gt;Socket-&gt;ReceiveLength();
    BYTE *Buffer = new BYTE[nBytes];
    ClientSocket1-&gt;Socket-&gt;ReceiveBuf(Buffer, nBytes);
    memory-&gt;Write(Buffer, nBytes);
  }
  else if(is_error) {
    ClientSocket1-&gt;Close();
    Application-&gt;MessageBoxA(&quot;Sorry, but the requested file doesn't exist!&quot;, &quot;ERROR&quot;, MB_OK);
  }
}
//---------------------------------------------------------------------------

void __fastcall TfrmMain::ClientSocket1Disconnect(TObject *Sender, TCustomWinSocket *Socket) {
  if(!is_error) {
    ProgressBar1-&gt;Max = memory-&gt;Size;
    ProgressBar1-&gt;Position = 0;
    memory-&gt;Position = 0;

    // Writing file
    memory-&gt;SaveToFile(this-&gt;lfd[this-&gt;file_id].full_local_path.c_str());

    ProgressBar1-&gt;Position = memory-&gt;Size;
    ClientSocket1-&gt;Close();

    if(Application-&gt;MessageBoxA(&quot;Download finished!&quot;, &quot;SUCCESS&quot;, MB_OK) == ID_OK)
    ProgressBar1-&gt;Position = 0;

    delete memory;
    _sleep(3);
    if(this-&gt;file_id == 0) {
      ClientSocket1-&gt;Close();
      if(Application-&gt;MessageBox(&quot;Download completed!&quot;, &quot;Info&quot;, MB_OK) == ID_OK) {
        frmProgress-&gt;Position = 0;
        frmProgress-&gt;Close();
      }
    }
  }
}
//---------------------------------------------------------------------------

void __fastcall TfrmMain::ClientSocket1Error(TObject *Sender, TCustomWinSocket *Socket,
                                             TErrorEvent ErrorEvent, int &amp;ErrorCode) {
  // analyse ErrorEvent
  String Msg = &quot;Unspecified ClientSocket error.&quot;;
  switch(ErrorEvent) {
    case eeGeneral :
      Msg = &quot;The socket received an error message that does not fit into any category.&quot;;
    case eeSend :
      Msg = &quot;An error occurred when trying to write to the socket connection.&quot;;
      break;
    case eeReceive :
      Msg =  &quot;An error occurred when trying to read from the socket connection.&quot;;
      break;
    case eeConnect :
      Msg = &quot;A connection request that was already accepted could not be completed.&quot;;
      break;
    case eeDisconnect :
      Msg = &quot;An error occurred when trying to close a connection.&quot;;
      break;
    case eeAccept :
      Msg = &quot;A problem occurred when trying to accept a client connection request.&quot;;
  }
  Application-&gt;MessageBox(Msg.c_str(), &quot;ClientSocket Error&quot;, MB_OK | MB_ICONSTOP);

  // prevent exception
  ErrorCode = 0;
}
//---------------------------------------------------------------------------
</code></pre>
<p>Kann mir jemand sagen, was ich da falsch mache? Mit Thread's kenne ich mich leider noch nicht aus, aber es sollte doch hintereinander funktionieren.</p>
<p>Vielen Dank im Voraus</p>
<p>Lg _freeze_</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/93809/tclientsocket-mehrere-dateien-herunterladen</link><generator>RSS for Node</generator><lastBuildDate>Thu, 09 Jul 2026 15:34:03 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/93809.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 02 Dec 2004 19:52:08 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to TClientSocket + mehrere Dateien herunterladen? on Thu, 02 Dec 2004 19:52:08 GMT]]></title><description><![CDATA[<p>Hey @all,</p>
<p>das man mit TClientSocket eine Datei mit der GET Anweisung herunterladen kann ist klar. Aber wie kann ich beispielsweise mehrere Dateien herunterladen, den da scheitert es bei mir dauernd</p>
<p>Hier mal mein Source</p>
<pre><code class="language-cpp">void __fastcall TfrmMain::Button2Click(TObject *Sender) {
  try {
    frmNetwork-&gt;cbUseProxy-&gt;Checked = netopt-&gt;get_use_proxy();
    frmNetwork-&gt;tfProxyServer-&gt;Text = netopt-&gt;get_proxy_address().c_str();
    frmNetwork-&gt;tfProxyPort-&gt;Text = netopt-&gt;get_proxy_port().c_str();
    frmNetwork-&gt;tfProtocol-&gt;Text = netopt-&gt;get_protocol().c_str();
    frmNetwork-&gt;tfProtocolVersion-&gt;Text = netopt-&gt;get_protocol_version().c_str(); 
    frmNetwork-&gt;tfDownloadServer-&gt;Text = netopt-&gt;get_server_address().c_str();
    frmNetwork-&gt;tfDownloadPath-&gt;Text = netopt-&gt;get_server_path().c_str();
    frmNetwork-&gt;tfFilenameLayout-&gt;Text = netopt-&gt;get_filename_layout().c_str();

    string filename;
    int do_what = 0;
    if((cbDay1-&gt;ItemIndex &gt;= 0 &amp;&amp; cbMonth1-&gt;ItemIndex &gt;= 0 &amp;&amp; cbYear1-&gt;ItemIndex &gt;= 0) &amp;&amp;
       !(cbDay2-&gt;ItemIndex &gt;= 0 &amp;&amp; cbMonth2-&gt;ItemIndex &gt;= 0 &amp;&amp; cbYear2-&gt;ItemIndex &gt;= 0))
      do_what = 1;
    else if(!(cbDay1-&gt;ItemIndex &gt;= 0 &amp;&amp; cbMonth1-&gt;ItemIndex &gt;= 0 &amp;&amp; cbYear1-&gt;ItemIndex &gt;= 0) &amp;&amp;
            (cbDay2-&gt;ItemIndex &gt;= 0 &amp;&amp; cbMonth2-&gt;ItemIndex &gt;= 0 &amp;&amp; cbYear2-&gt;ItemIndex &gt;= 0))
      do_what = 2;
    else if((cbDay1-&gt;ItemIndex &gt;= 0 &amp;&amp; cbMonth1-&gt;ItemIndex &gt;= 0 &amp;&amp; cbYear1-&gt;ItemIndex &gt;= 0) &amp;&amp;
            (cbDay2-&gt;ItemIndex &gt;= 0 &amp;&amp; cbMonth2-&gt;ItemIndex &gt;= 0 &amp;&amp; cbYear2-&gt;ItemIndex &gt;= 0))
      do_what = 3;
    else
      throw GASException(&quot;You must define all fields in FROM, TO or BOTH!&quot;);

    bool day_zero = false;
    bool month_zero = false;
    switch(do_what) {
      case 1: this-&gt;year = cbYear1-&gt;ItemIndex + 1978;
              this-&gt;month = cbMonth1-&gt;ItemIndex + 1;
              this-&gt;day = cbDay1-&gt;ItemIndex + 1;
              if((cbDay1-&gt;ItemIndex + 1) &lt; 10)
                day_zero = true;
              if((cbMonth1-&gt;ItemIndex + 1) &lt; 10)
                month_zero = true;
              break;
      case 2: this-&gt;year = cbYear2-&gt;ItemIndex + 1978;
              this-&gt;month = cbMonth2-&gt;ItemIndex + 1;
              this-&gt;day = cbDay2-&gt;ItemIndex + 1;
              if((cbDay2-&gt;ItemIndex + 1) &lt; 10)
                day_zero = true;
              if((cbMonth2-&gt;ItemIndex + 1) &lt; 10)
                month_zero = true;
              break;
    }

    // building filename

    this-&gt;filename = netopt-&gt;parse_macros(netopt-&gt;get_filename_layout(), year, month, day);
    string tmpDir = this-&gt;directory;
    string tmpFilename;

    if(this-&gt;directory != &quot;&quot;) {
      check_for_slashes(tmpDir, false);
      check_for_bslashes(tmpDir, true);
      tmpFilename = tmpDir + this-&gt;filename;
    }

    // Datei am Server - Lokales Verzeichnis - Lokale Datei
    this-&gt;lfd.push_back(FileData(&quot;1.gif&quot;, this-&gt;directory, &quot;test1.gif&quot;));
    this-&gt;lfd.push_back(FileData(&quot;2.gif&quot;, this-&gt;directory, &quot;test2.gif&quot;));
    this-&gt;lfd.push_back(FileData(&quot;3.gif&quot;, this-&gt;directory, &quot;test3.gif&quot;));
    this-&gt;lfd.push_back(FileData(&quot;4.gif&quot;, this-&gt;directory, &quot;test4.gif&quot;));
    this-&gt;lfd.push_back(FileData(&quot;5.gif&quot;, this-&gt;directory, &quot;test5.gif&quot;));
    this-&gt;lfd.push_back(FileData(&quot;6.gif&quot;, this-&gt;directory, &quot;test6.gif&quot;));
    this-&gt;lfd.push_back(FileData(&quot;7.gif&quot;, this-&gt;directory, &quot;test7.gif&quot;));
    this-&gt;lfd.push_back(FileData(&quot;8.gif&quot;, this-&gt;directory, &quot;test8.gif&quot;));
    this-&gt;lfd.push_back(FileData(&quot;9.gif&quot;, this-&gt;directory, &quot;test9.gif&quot;));
    this-&gt;lfd.push_back(FileData(&quot;10.gif&quot;, this-&gt;directory, &quot;test10.gif&quot;));

//    lfd.push_back(FileData(this-&gt;filename, this-&gt;directory, tmpFilename));

    // Wird ein Proxy benutzt?
    if(netopt-&gt;get_use_proxy()) {
      ClientSocket1-&gt;Host = netopt-&gt;get_proxy_address().c_str();
      ClientSocket1-&gt;Port = StrToInt(netopt-&gt;get_proxy_port().c_str());
    }
    else if(!netopt-&gt;get_use_proxy()) {
      ClientSocket1-&gt;Host = netopt-&gt;get_server_address().c_str();
      ClientSocket1-&gt;Port = 80;
    }

    if(!ClientSocket1-&gt;Active) {
      ClientSocket1-&gt;Open();
      frmProgress-&gt;Bar-&gt;Max = lfd.size();
      frmProgress-&gt;Bar-&gt;Position = 0;
      frmProgress-&gt;Show();
    }

  }
  catch(GASException&amp; e) {
    Application-&gt;MessageBoxA(e.what(), e.error(), MB_OK); 
  }
}
//---------------------------------------------------------------------------

void __fastcall TfrmMain::ClientSocket1Connect(TObject *Sender, TCustomWinSocket *Socket) {
  unsigned int file_counter = lfd.size();
  for(lfdIter = lfd.begin(); lfdIter != lfd.end(); ++lfdIter) {
    file_counter-=1;
    this-&gt;file_id = file_counter;

    AnsiString progress_message;
    progress_message.cat_sprintf(&quot;%d/%d %s&quot;, lfd.size()-file_counter, lfd.size(), this-&gt;lfd[this-&gt;file_id].full_local_path.c_str());
    frmProgress-&gt;lDownloadFile-&gt;Caption = progress_message;

    AnsiString get_buffer;
    get_buffer.cat_sprintf(&quot;GET %s%s/%s/%s HTTP/%s \n\n&quot;, netopt-&gt;get_protocol().c_str(),
                                                          ClientSocket1-&gt;Host,
                                                          netopt-&gt;parse_macros(netopt-&gt;get_server_path(), year, month, day).c_str(),
                                                          this-&gt;lfd[this-&gt;file_id].server_file.c_str(),
                                                          netopt-&gt;get_protocol_version().c_str());
    memory = new TMemoryStream();
    found_gif = false;
    ClientSocket1-&gt;Socket-&gt;SendText(get_buffer);
    _sleep(2);
  }
}
//---------------------------------------------------------------------------

void __fastcall TfrmMain::ClientSocket1Read(TObject *Sender, TCustomWinSocket *Socket) {
  bool is_header = false;
  is_error = false;
  if(!found_gif) {
    AnsiString Response;
    int nBytes = ClientSocket1-&gt;Socket-&gt;ReceiveLength();
    BYTE *Buffer = new BYTE[nBytes];
    ClientSocket1-&gt;Socket-&gt;ReceiveBuf(Buffer, nBytes);
    for(int i=0; i&lt;nBytes; i++) {
      if((Buffer[i] == 'G' &amp;&amp; Buffer[i+1] == 'I' &amp;&amp; Buffer[i+2] == 'F') ||
         is_header) {
	is_header = true;
        BYTE *b = new BYTE[1];
        b[0] = Buffer[i];
	memory-&gt;Write(b, 1);
      }
      else if ((Buffer[i] == 'N' &amp;&amp; Buffer[i+1] == 'o' &amp;&amp; Buffer[i+2] == 't' &amp;&amp;
                Buffer[i+3] == ' ' &amp;&amp; Buffer[i+4] == 'F' &amp;&amp; Buffer[i+5] == 'o' &amp;&amp;
                Buffer[i+6] == 'u' &amp;&amp; Buffer[i+7] == 'n' &amp;&amp; Buffer[i+8] == 'd')) {
	is_header = true;
        is_error = true;
      }         
    }
    found_gif = true;
  }

  if(found_gif &amp;&amp; !is_error) {
    AnsiString Response;
    int nBytes = ClientSocket1-&gt;Socket-&gt;ReceiveLength();
    BYTE *Buffer = new BYTE[nBytes];
    ClientSocket1-&gt;Socket-&gt;ReceiveBuf(Buffer, nBytes);
    memory-&gt;Write(Buffer, nBytes);
  }
  else if(is_error) {
    ClientSocket1-&gt;Close();
    Application-&gt;MessageBoxA(&quot;Sorry, but the requested file doesn't exist!&quot;, &quot;ERROR&quot;, MB_OK);
  }
}
//---------------------------------------------------------------------------

void __fastcall TfrmMain::ClientSocket1Disconnect(TObject *Sender, TCustomWinSocket *Socket) {
  if(!is_error) {
    ProgressBar1-&gt;Max = memory-&gt;Size;
    ProgressBar1-&gt;Position = 0;
    memory-&gt;Position = 0;

    // Writing file
    memory-&gt;SaveToFile(this-&gt;lfd[this-&gt;file_id].full_local_path.c_str());

    ProgressBar1-&gt;Position = memory-&gt;Size;
    ClientSocket1-&gt;Close();

    if(Application-&gt;MessageBoxA(&quot;Download finished!&quot;, &quot;SUCCESS&quot;, MB_OK) == ID_OK)
    ProgressBar1-&gt;Position = 0;

    delete memory;
    _sleep(3);
    if(this-&gt;file_id == 0) {
      ClientSocket1-&gt;Close();
      if(Application-&gt;MessageBox(&quot;Download completed!&quot;, &quot;Info&quot;, MB_OK) == ID_OK) {
        frmProgress-&gt;Position = 0;
        frmProgress-&gt;Close();
      }
    }
  }
}
//---------------------------------------------------------------------------

void __fastcall TfrmMain::ClientSocket1Error(TObject *Sender, TCustomWinSocket *Socket,
                                             TErrorEvent ErrorEvent, int &amp;ErrorCode) {
  // analyse ErrorEvent
  String Msg = &quot;Unspecified ClientSocket error.&quot;;
  switch(ErrorEvent) {
    case eeGeneral :
      Msg = &quot;The socket received an error message that does not fit into any category.&quot;;
    case eeSend :
      Msg = &quot;An error occurred when trying to write to the socket connection.&quot;;
      break;
    case eeReceive :
      Msg =  &quot;An error occurred when trying to read from the socket connection.&quot;;
      break;
    case eeConnect :
      Msg = &quot;A connection request that was already accepted could not be completed.&quot;;
      break;
    case eeDisconnect :
      Msg = &quot;An error occurred when trying to close a connection.&quot;;
      break;
    case eeAccept :
      Msg = &quot;A problem occurred when trying to accept a client connection request.&quot;;
  }
  Application-&gt;MessageBox(Msg.c_str(), &quot;ClientSocket Error&quot;, MB_OK | MB_ICONSTOP);

  // prevent exception
  ErrorCode = 0;
}
//---------------------------------------------------------------------------
</code></pre>
<p>Kann mir jemand sagen, was ich da falsch mache? Mit Thread's kenne ich mich leider noch nicht aus, aber es sollte doch hintereinander funktionieren.</p>
<p>Vielen Dank im Voraus</p>
<p>Lg _freeze_</p>
]]></description><link>https://www.c-plusplus.net/forum/post/664762</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/664762</guid><dc:creator><![CDATA[_freeze_]]></dc:creator><pubDate>Thu, 02 Dec 2004 19:52:08 GMT</pubDate></item><item><title><![CDATA[Reply to TClientSocket + mehrere Dateien herunterladen? on Thu, 02 Dec 2004 20:16:02 GMT]]></title><description><![CDATA[<p>Warum erstelst du 2 thread mit der gleichen Frage?<br />
Sowas ist hier unerwünscht... der eine thread reichte schon..</p>
]]></description><link>https://www.c-plusplus.net/forum/post/664774</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/664774</guid><dc:creator><![CDATA[DJ BlackEagle]]></dc:creator><pubDate>Thu, 02 Dec 2004 20:16:02 GMT</pubDate></item><item><title><![CDATA[Reply to TClientSocket + mehrere Dateien herunterladen? on Thu, 02 Dec 2004 20:22:26 GMT]]></title><description><![CDATA[<p>Sorry, für den zweiten Thread, kann ein Moderator bitte meinen ersten Thread löschen</p>
<p>Vielen Dank<br />
Lg _freeze_</p>
]]></description><link>https://www.c-plusplus.net/forum/post/664779</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/664779</guid><dc:creator><![CDATA[_freeze_]]></dc:creator><pubDate>Thu, 02 Dec 2004 20:22:26 GMT</pubDate></item></channel></rss>