🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.internet.socket
8 messages
8 total messages Started by RobertL Wed, 13 Sep 2006 13:01
Bug? TIdTCPServer does not change Defaultport at runtime
#2019
Author: RobertL
Date: Wed, 13 Sep 2006 13:01
19 lines
1363 bytes
Hi all,

with this code I try to change the defaultport property and it shows the desired port in the listbox, but allways the port set at designtime is active, there is no change to the new value.

Is this a bug? Or am I doing something wrong)

I use Indy 9 and BDS2006.

...
void __fastcall TForm1::Edit1DblClick(TObject *Sender)
{
  IdTCPServer1->DefaultPort=StrToInt(Edit1->Text);
  ListBox1->Items->Add( "Port set to: " +
IntToStr(IdTCPServer1->DefaultPort) );
}
...

Regards Robert
Re: Bug? TIdTCPServer does not change Defaultport at runtime
#2021
Author: Omar Zelaya
Date: Wed, 13 Sep 2006 16:29
26 lines
1707 bytes
try setting the Active property to false, before changing the DefaultPort 
and setting it back to true when done.

"RobertL" <nospam@nospam.com> wrote in message 
news:4508012b$1@newsgroups.borland.com...
>
> Hi all,
>
> with this code I try to change the defaultport property and it shows the 
> desired port in the listbox, but allways the port set at designtime is 
> active, there is no change to the new value.
>
> Is this a bug? Or am I doing something wrong)
>
> I use Indy 9 and BDS2006.
>
> ...
> void __fastcall TForm1::Edit1DblClick(TObject *Sender)
> {
>  IdTCPServer1->DefaultPort=StrToInt(Edit1->Text);
>  ListBox1->Items->Add( "Port set to: " +
> IntToStr(IdTCPServer1->DefaultPort) );
> }
> ...
>
> Regards Robert 
Re: Bug? TIdTCPServer does not change Defaultport at runtime
#2022
Author: Remy Lebeau (TeamB)
Date: Wed, 13 Sep 2006 16:47
18 lines
1696 bytes
"RobertL" <nospam@nospam.com> wrote in message
news:4508012b$1@newsgroups.borland.com...

> with this code I try to change the defaultport property and it
> shows the desired port in the listbox, but allways the port set
> at designtime is active, there is no change to the new value.

Do you have any items already created in the Bindings collection when you
make the change?  Changing the DefaultPort has no effect on existing items
in the Bindings collection, only on new items that are added to the
collection afterwards.  Each Binding has its own Port property that it
listens on.  That value is initialized by the DefaultPort only when the
Binding is first created.  Changing the DefaultPort does not update the Port
of existing Bindings.


Gambit
Re: Bug? TIdTCPServer does not change Defaultport at runtime
#2023
Author: Remy Lebeau (TeamB)
Date: Wed, 13 Sep 2006 16:49
15 lines
1512 bytes
"Omar Zelaya" <ozelaya2010@hotmail.com> wrote in message
news:450831c3@newsgroups.borland.com...

> try setting the Active property to false, before changing
> the DefaultPort and setting it back to true when done.

That will not have any effect if there are already items in the Bindings
collection.  If you set Active to false, you would have to also clear the
Bindings collection in order for the collection to use the new DefaultPort
value.  Otherwise, you will have to loop through the collection itself
updating the Port property of the individual Binding items.


Gambit
Re: Bug? TIdTCPServer does not change Defaultport at runtime
#2024
Author: RobertL
Date: Wed, 13 Sep 2006 18:05
11 lines
1410 bytes
>Changing the DefaultPort does not update the Port
> of existing Bindings.

hmm....

I didn't do anything with the binding collection. But what should I do when 
I want to change the active port? Do I have to use another property or how 
else can I update the port of an existing Binding ? Can you show me an 
example?

Regards Robert
Re: Bug? TIdTCPServer does not change Defaultport at runtime
#1926
Author: RobertL
Date: Wed, 13 Sep 2006 19:02
39 lines
2473 bytes
Thank you for your quick help Gambit,

in the meantime I found the way to clear the binding according to your tip:
...
void __fastcall TForm1::Edit1DblClick(TObject *Sender)
{
 IdTCPServer1->Active=false;
 IdTCPServer1->Bindings->Clear();
 IdTCPServer1->DefaultPort=StrToInt(Edit1->Text);
 IdTCPServer1->Active=true;
 ListBox1->Items->Add( "Port: " + IntToStr(IdTCPServer1->DefaultPort) );
}
...

Regards Robert

"Remy Lebeau (TeamB)" <no.spam@no.spam.com> schrieb im Newsbeitrag 
news:450836b4$1@newsgroups.borland.com...
>
> "RobertL" <nospam@nospam.com> wrote in message
> news:4508012b$1@newsgroups.borland.com...
>
>> with this code I try to change the defaultport property and it
>> shows the desired port in the listbox, but allways the port set
>> at designtime is active, there is no change to the new value.
>
> Do you have any items already created in the Bindings collection when you
> make the change?  Changing the DefaultPort has no effect on existing items
> in the Bindings collection, only on new items that are added to the
> collection afterwards.  Each Binding has its own Port property that it
> listens on.  That value is initialized by the DefaultPort only when the
> Binding is first created.  Changing the DefaultPort does not update the 
> Port
> of existing Bindings.
>
>
> Gambit
>
> 
Re: Bug? TIdTCPServer does not change Defaultport at runtime
#1944
Author: RobertL
Date: Fri, 15 Sep 2006 11:51
20 lines
1643 bytes
Thank you for your quick reply, Gambit.

I wrote a reply at the same evening from home, but it looks at it has got stuck in my providers newsserver, I can see it there, but not in the newsgroup accessed via Webinterface. 

In the meantime, I could successfully change the active port. 

According to our tip, I had a look at the BINDINGS and with insertion of a Clear() command it worked.

void __fastcall TForm1::Edit1DblClick(TObject *Sender)
{
IdTCPServer1->Active=false;
IdTCPServer1->DefaultPort=StrToInt(Edit1->Text);
IdTCPServer1->Bindings->Clear();
IdTCPServer1->Active=true;
ListBox1->Items->Add( "Port set to: " + 
 IntToSt(IdTCPServer1->DefaultPort) );
}  

Regards Robert
Re: Bug? TIdTCPServer does not change Defaultport at runtime
#1947
Author: RobertL
Date: Sat, 16 Sep 2006 15:44
3 lines
1232 bytes
I tried that already with no success.

Regards Robert
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads