• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 883
  • Last Modified:

Change Listen UDPPort for IdUDPServer at run time

I set Indy UDPServer's DefaultPort at design time, but I would like to change it at run time.
I found that after I change DefaultPort at run time, the server still use the original Default port numer.

IdUDPServer.Active:=False;
IdUDPServer.DefaultPort:=2345
IdUDPServer.Active:=True;

Above code cannot change the DefaultPort.

How should I do?

ysimon
0
ysimon
Asked:
ysimon
1 Solution
 
2266180Commented:
that is because there are already some bindings created (by default if you don't create some yourself). so the solutino would be:

  IdUDPServer1.Active:=false;
  IdUDPServer1.Bindings.Clear;
  IdUDPServer1.DefaultPort:=2345;
  IdUDPServer1.Active:=true;
0
 
ysimonAuthor Commented:
It works great after adding Bindings.Clear.

ysimon
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now