🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: EidClosedSocket with message 'Disconnected'

#590
From: SKLIM
Date: Tue, 27 Nov 2007 02:18
40 lines
2516 bytes
"Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> wrote:
>
>"SKLIM" <sklim82@hotmail.com> wrote in message 
>news:474a9a54$1@newsgroups.borland.com...
>
>> I am using Indy 9.0.4. Currently I am working on TCPServer and
>> facing problem to disconnect all connected client.
>
>That is because you are disconnecting them wrong.  You are closing the 
>Binding itself, not the clients that are connected to it.  You would have to 
>loop through the entries in the server's ActiveThreads list, calling 
>DisconnectSocket() on each one individually.
>

Before I tried with the binding, I did call DisconnectSocket for each activeThread and they have the same exception. The following are the code:
        TList *lstThread = tcpServer->Threads->LockList();
        int iConnectedClientCount = lstThread->Count;
        TIdPeerThread *AThread;
        for(int i=0; i<iConnectedClientCount; i++){
                AThread = (TIdPeerThread *)lstThread->Items[i];
                try{
                        AThread->Connection->DisconnectSocket();
                }
                catch(const Exception &e){
                        continue;
                }
        }
        tcpServer->Threads->UnlockList();

Exception shows when DisconnectSocket is called.


>> Any suggestion to gracefully disconnect all connected clients?
>
>You should not be disconnecting them manually to begin with.  Setting the 
>Active property to false by itself will internally disconnect all active 
>clients for you.

Set the active property to false has the same exception.
Technical Details
Message-ID: <474b8c73$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <474a9a54$1@newsgroups.borland.com> <474b043f$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,8ed7ff271444a626
X-Google-Attributes: gid11508e,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: "SKLIM" <sklim82@hotmail.com>
Sender: "SKLIM" <sklim82@hotmail.com>
Reply-To: "SKLIM" <sklim82@hotmail.com>
Subject: Re: EidClosedSocket with message 'Disconnected'
Newsgroups: borland.public.cppbuilder.internet.socket
X-User-Info: 203.223.133.194     
References: <474a9a54$1@newsgroups.borland.com> <474b043f$1@newsgroups.borland.com>
NNTP-Posting-Host: 207.105.83.66
Message-ID: <474b8c73$1@newsgroups.borland.com>
Date: 26 Nov 2007 19:18:11 -0700
X-Trace: newsgroups.borland.com 1196133491 207.105.83.66 (26 Nov 2007 19:18:11 -0700)
Lines: 42
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail