Article View: borland.public.cppbuilder.internet.socket
Article #5760Re: TServerSocket - Limiting Connections
From: Joe St. Onge
Date: Tue, 22 Jun 2004 15:23
Date: Tue, 22 Jun 2004 15:23
38 lines
2227 bytes
2227 bytes
Hans,
I modified my code as you suggested...
void __fastcall TMainForm::ChanServerSocketAccept(TObject *Sender,
TCustomWinSocket *Socket)
{
if (ChanServerSocket->Socket->ActiveConnections > 1)
Socket->Close();
}
What happened is that the Socket->Close() also closed my existing socket. I
am attempting to keep one connection per socket and not accept any more
connections on that socket until the first has finished...
"Hans Galema" <dontusethis@dontusethis.nl> wrote in message
news:40d84b21$1@newsgroups.borland.com...
> Joe St. Onge wrote:
>
> > Hi Remy,
>
> A selective greeting for one of the replyers.
>
> > void __fastcall TMainForm::ChanServerSocketAccept(TObject *Sender,
> > TCustomWinSocket *Socket)
> > {
> > if (MainForm->Connections++)
> > ChanServerSocket->Close();
>
> Why do you use a MainForm->Connection ? TServerSocket keeps
> track of the number of active connections. And why do you
> close The ChanServerSocket instead of the actual Socket;
>
> if ( ChanServerSocket->Socket->ActiveConnections )
> Socket->Close();
>
> Hans.
Technical Details
Message-ID:
<40d84edf$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<40d739d9@newsgroups.borland.com> <40d75c9d$1@newsgroups.borland.com> <40d84965$1@newsgroups.borland.com> <40d84b21$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11508e,68e81cd18de9d3fe X-Google-Attributes: gid11508e,public Reply-To: "Joe St. Onge" <jstonge@nel-techlabs.com> From: "Joe St. Onge" <jstonge@nel-techlabs.com> Newsgroups: borland.public.cppbuilder.internet.socket References: <40d739d9@newsgroups.borland.com> <40d75c9d$1@newsgroups.borland.com> <40d84965$1@newsgroups.borland.com> <40d84b21$1@newsgroups.borland.com> Subject: Re: TServerSocket - Limiting Connections Date: Tue, 22 Jun 2004 11:23:11 -0400 Lines: 40 Organization: Nel-Tech Labs 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: 216.41.126.194 Message-ID: <40d84edf$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1087917791 216.41.126.194 (22 Jun 2004 08:23:11 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail