Board index » delphi » Problems changing the port of a TIdTCPServer

Problems changing the port of a TIdTCPServer


2004-04-02 05:36:09 PM
delphi253
Hi,
I have an application that listens to a port specified by the user. It works
fine the first time I put the server active, but if stop it, change the port
and put it active again, it still receives connections from the old port.
Do I miss something?
The code would be something like that:
Server.DefaultPort:=10001;
Server.Active := true;
DoALotOfThings;
Server.ThreadMgr.TerminateThreads;
Server.Active:=false;
Server.DefaultPort:=10002;
Server.Active:=true;
Thanks,
Arnau
 
 

Re:Problems changing the port of a TIdTCPServer

try Bindings.Clear;
"Arnau Font" <XXXX@XXXXX.COM>writes
Quote
Hi,

I have an application that listens to a port specified by the user. It
works
fine the first time I put the server active, but if stop it, change the
port
and put it active again, it still receives connections from the old port.

Do I miss something?

The code would be something like that:

Server.DefaultPort:=10001;
Server.Active := true;
DoALotOfThings;
Server.ThreadMgr.TerminateThreads;
Server.Active:=false;
Server.DefaultPort:=10002;
Server.Active:=true;

Thanks,
Arnau



 

Re:Problems changing the port of a TIdTCPServer

Thanks, now it works as expected!
"Lee_Nover" <Lee_Nover[nospam]@delphi-si.com>escribi?en el mensaje
Quote
try Bindings.Clear;

"Arnau Font" <XXXX@XXXXX.COM>writes
news:XXXX@XXXXX.COM...
>Hi,
>
>I have an application that listens to a port specified by the user. It
works
>fine the first time I put the server active, but if stop it, change the
port
>and put it active again, it still receives connections from the old
port.
>
>Do I miss something?
>
>The code would be something like that:
>
>Server.DefaultPort:=10001;
>Server.Active := true;
>DoALotOfThings;
>Server.ThreadMgr.TerminateThreads;
>Server.Active:=false;
>Server.DefaultPort:=10002;
>Server.Active:=true;
>
>Thanks,
>Arnau
>
>
>