Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delphi detecting local port of the Indy Client Component

Tags:

delphi

indy

I need to know the local port of Indy TCP Client component during it is connecting with server. As I read the manual, the BoundPort is local port of Indy Client component. But this value always returns 0, not real local port. Really BountPort indicates the local port of client component? And I took mistakes when getting it? Or,any other good method of detecting the local port?

like image 948
fangrenxing Avatar asked Oct 29 '25 11:10

fangrenxing


1 Answers

The TIdTCPClient.BoundPort property is the port that YOU want the client to bind to locally. It is 0 by default, so the client can bind to whatever random port is available. Regardless of what the BoundPort is set to, the port that is actually bound to is available in the TIdTCPClient.Socket.Binding.Port property after the TIdTCPClient.Connect() method is successful.

like image 151
Remy Lebeau Avatar answered Nov 01 '25 13:11

Remy Lebeau



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!