🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Changing a Binding port in the TIdTCPServer

#5761
From: dsiders
Date: Tue, 22 Jun 2004 16:36
43 lines
2303 bytes
"McKool" <kenethw@peak-system.com> wrote in message news:40d83978@newsgroups.borland.com...

> I want to give (if it is possible) to the user the possibility to stop the
> server, change the port and start it again.  I made it with MyServer->Active
> = false but the Server do not take the new port number.
 
> Is there a way to do that?

I think your problem occurs because Bindings have already been created for listener thread(s) when Active was set to True.  Setting the DefaultPort property does not change anything already allocated in Bindings.

Options:

* For multiple Bindings, set the port number directly in each of the existing Bindings.
  
  TIdTCPServer->Bindings[i]->Port = myIntPort;

* To use a single default Binding, just clear the existing Bindings and set DefaultPort.

 TIdTCPServer->Bindings->Clear();
 TIdTCPServer->DefaultPort = myIntPort;

Either of these options has to be done when Active is False.


> Where can I post a message to learn how to make a program in
> C++ Builder that work like a services in Windows NT ? 

I don't have C++ Builder installed at the moment, but the Delphi VCL reference has docs for TServiceApplication and TService.  C++Builder should also.  

Not sure which NG would be best...

hth...
Technical Details
Message-ID: <40d8600b$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <40d83978@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11508e,2cf01be21fbab370
X-Google-Attributes: gid11508e,public
From: "dsiders" <mudshark@rancidbud.org>
Newsgroups: borland.public.cppbuilder.internet.socket
References: <40d83978@newsgroups.borland.com>
Subject: Re: Changing a Binding port in the TIdTCPServer
Date: Tue, 22 Jun 2004 12:36:25 -0400
Lines: 45
MIME-Version: 1.0
Content-Type: text/plain;
 charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
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.119.132.174
Message-ID: <40d8600b$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1087922187 68.119.132.174 (22 Jun 2004 09:36:27 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail