Article View: borland.public.cppbuilder.internet.socket
Article #3032Re: About changing DefaultPort on TIdTCPServer...
From: Remy Lebeau (TeamB)
Date: Fri, 25 Nov 2005 06:41
Date: Fri, 25 Nov 2005 06:41
35 lines
2350 bytes
2350 bytes
"Vladimir Stefanovic" <antivari@po.sbb.co.yu> wrote in message
news:4385e08a@newsgroups.borland.com...
> After next three commands the server continued to...
> ... *function* but with *old* value!!! My clients...
> still could connect by the *old* Port value, and not the new one!
> WHY?
Changing the DefaultPort property has no effect at all on existing entries
in the TIdTCPServer's Bindings collection. In order to change the port that
they are listening on, you need to either:
1) clear the Bindings collection and then re-add the desired entries to it
before activating the server. New entries added to the collection will pick
up the current DefaultPort value:
IdTCPServer->Active = false;
IdTCPServer->DefaultPort = StrToInt(CONFIG_PORT);
IdTCPServer->Bindings->Clear();
for(int x = 0; x < NumberOfDesiredBindings; ++x)
IdTCPServer->Bindings->Add()->IP = "whatever";
IdTCPServer->Active = true;
2) loop through the existing entries in the Bindings collection changing
their Port properties individually:
int NewPort = StrToInt(CONFIG_PORT);
IdTCPServer->Active = false;
for(int x = 0; x < IdTCPServer->Bindings->Count; ++x)
IdTCPServer->Bindings->Items[x]->Port = NewPort;
IdTCPServer->Active = true;
Gambit
Technical Details
Message-ID:
<4386b215$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newscon06.news.prodigy.com!newscon02.news.prodigy.com!prodigy.net!nx02.iad01.newshosting.com!newshosting.com!news-out.newsfeeds.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<4385e08a@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,1582af998fda5c7c 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: <4385e08a@newsgroups.borland.com> Subject: Re: About changing DefaultPort on TIdTCPServer... Date: Thu, 24 Nov 2005 22:41:34 -0800 Lines: 37 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: 68.69.17.41 Message-ID: <4386b215$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1132900885 68.69.17.41 (24 Nov 2005 22:41:25 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newscon06.news.prodigy.com!newscon02.news.prodigy.com!prodigy.net!nx02.iad01.newshosting.com!newshosting.com!news-out.newsfeeds.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail