Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
TIdTCP(CMD)Server bindings
#2
(12-13-2024, 10:44 PM)Justin Case Wrote: Is there a way to change the bindings while the server is running?

Not officially, no. And this is the wrong approach for your situation anyway.

(12-13-2024, 10:44 PM)Justin Case Wrote: I'd like to be able to send a command to my server and have it bind to another port and accept a connection there - but only when instructed to do so. After use, I'd like that binding to vanish and it stop listening there.

I would suggest a different approach - have your command handler create a new TIdSimpleServer object, which is designed for 1:1 connections. Have it Listen() on the desired port, then you can communicate with the accepted connection via its IOHandler as needed, and then you can free it when finished.  There is no need to manipulate the main server.

Have a look at the implementation of the TIdFTP and TIdFTPServer components. They both use TIdSimpleServer internally when creating secondary inbound connections - TIdFTP during an active mode transfer, and TIdFTPServer during a passive mode transfer.

Reply


Messages In This Thread
TIdTCP(CMD)Server bindings - by Justin Case - 12-13-2024, 10:44 PM
RE: TIdTCP(CMD)Server bindings - by rlebeau - 12-14-2024, 08:04 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)