🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.socket
Article #1232

Re: system error code 6 when closing TClientSocket

#1232
From: Remy Lebeau (TeamB)
Date: Thu, 22 Feb 2007 10:47
34 lines
1947 bytes
"enzo" <enzo.arlati@aesys.it> wrote in message
news:mn.b29a7d72294c86fa.47611@aesys.it...

> when I try to close the thread with Terminate and waitFor
> I got a system error code 6.

6 = ERROR_INVALID_HANDLE

You are setting the thread's FreeOnTerminate property to true.  You
can't use WaitFor() and FreeOnTerminate together.  That is a bug that
was introduced in BCB 6.  If you want to use WaitFor(), then leave
FreeOnTerminate set to its default value of false and then delete the
thread yourself after WaitFor() exits, ie:

    if( thClntSckt )
    {
        thClntSckt->Terminate();
        thClntSckt->WaitFor();
        delete thClntSckt; // <-- add this
        thClntSckt = NULL;
        return;
    }

    {
        thClntSckt = new ThClientSocket(true);
        // thClntSckt->FreeOnTerminate = true; // <-- Get rid of this
        thClntSckt->IPAddress = EditHost->Text;
        thClntSckt->Port = EditPort->Text.ToIntDef(0);
        thClntSckt->Resume();
      }


Gambit
Technical Details
Message-ID: <45dd7546$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <mn.b29a7d72294c86fa.47611@aesys.it>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,363e26bbeac0e744
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.internet.socket
References: <mn.b29a7d72294c86fa.47611@aesys.it>
Subject: Re: system error code 6 when closing TClientSocket
Date: Thu, 22 Feb 2007 02:47:27 -0800
Lines: 36
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 75.83.34.171
Message-ID: <45dd7546$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1172141382 75.83.34.171 (22 Feb 2007 02:49:42 -0800)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail