🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: TServerSocket - Limiting Connections

#5758
From: Joe St. Onge
Date: Tue, 22 Jun 2004 14:59
49 lines
2302 bytes
Hi Remy,

I did what you said and received the following error "exception class
EListError with message 'List index out of bounds (0)' "

This is the OnAccept code that I used...

void __fastcall TMainForm::ChanServerSocketAccept(TObject *Sender,
      TCustomWinSocket *Socket)
   {
   if (MainForm->Connections++)
      ChanServerSocket->Close();
   }

I then tried changing the routine to

void __fastcall TMainForm::ChanServerSocketAccept(TObject *Sender,
      TCustomWinSocket *Socket)
   {
   if (MainForm->Connections)
      MainForm->ChanServerSocket->Socket->Connections[1]->Close();
   }

and received the following error "exception class EListError with message
'Asynchronous socket error 10053' "

Isn't there a method to shutoff listening after accepting a connection and
keeping the current connection active???

Thanks,
Joe



"Remy Lebeau (TeamB)" <gambit47.no.spam@no.spam.yahoo.com> wrote in message
news:40d75c9d$1@newsgroups.borland.com...
>
> "Joe St. Onge" <jstonge@nel-techlabs.com> wrote in message
> news:40d739d9@newsgroups.borland.com...
>
> > Anyone know how to restrict the number of connections
> > that a server socket will accept?
>
> Use the OnAccept event to Close() the new connection.
>
>
> Gambit
>
>
Technical Details
Message-ID: <40d84965$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newshosting.com!nx01.iad01.newshosting.com!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <40d739d9@newsgroups.borland.com> <40d75c9d$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>
Subject: Re: TServerSocket - Limiting Connections
Date: Tue, 22 Jun 2004 10:59:51 -0400
Lines: 51
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: <40d84965$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1087916389 216.41.126.194 (22 Jun 2004 07:59:49 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newshosting.com!nx01.iad01.newshosting.com!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail