• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 973
  • 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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

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