Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to obtain a free local port automatical ?

18 views
Skip to first unread message

Karsten Leick

unread,
Jun 28, 2004, 10:46:02 AM6/28/04
to
Hello all !

Iam trying to open multiple connections to an FTP Server from a client by
using "IdFTP Client".

If i do not use different port adresses, i receive the Message "Socket Error
#10048 Adress already in use"
(As i understand, sometimes due to FD_WAIT state and sometimes due to a
"real still used" socket)

Now i am looking for the best way to find a free port adress for the
"BoundIP" property.

I remember that there was a way for TServerSocket like assigning a "0" to
the port and to get a free one
automatic assigned when opening the socket.

Is there any similar way for Indy or do i have to "browse" in an incremented
loop through the possible ports until it works ?

Thank you for any help in advance,
Karsten.


Remy Lebeau (TeamB)

unread,
Jun 28, 2004, 12:50:24 PM6/28/04
to

"Karsten Leick" <Karste...@cetecom.de> wrote in message
news:40e02f4d$1...@newsgroups.borland.com...

> Now i am looking for the best way to find a
> free port adress for the "BoundIP" property.

BoundIP is not a port number. It is an IP address, specifically the IP
address of the local network address that you want the component to
read/write its data from. Unless you are behind a firewall/router, or have
multiple network adapters installed, you usually don't have to assign the
BoundIP at all. The socket stack can look at the Host you are trying to
connect to and then pick the appropriate adapter to work with.

> I remember that there was a way for TServerSocket
> like assigning a "0" to the port and to get a free
> one automatic assigned when opening the socket.

That still applies with Indy as well. Simply set the BoundPort property to
0 (which it is already set to by default).


Gambit


Karsten

unread,
Jun 29, 2004, 6:14:02 AM6/29/04
to
Yep, sorry.

I meant BoundPort, just mixed it up in the post.

You are exactly right, it's working fine.

My Problem was a wrong assignment to the Port due to an input field,

i have used for the port assignment, which was unfortunately hidden

exactly under the one i though which was used ;)

May be a "copy&paste" accident.

Sorry for confusion and have great thanks for your efforts on helping me !

Karsten.

"Remy Lebeau (TeamB)" <gambit47...@no.spam.yahoo.com> schrieb im
Newsbeitrag news:40e04d32$1...@newsgroups.borland.com...

0 new messages