🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.internet.socket
3 messages
3 total messages Started by Karsten Leick Mon, 28 Jun 2004 14:46
How to obtain a free local port automatical ?
#5639
Author: Karsten Leick
Date: Mon, 28 Jun 2004 14:46
22 lines
1621 bytes
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.
Re: How to obtain a free local port automatical ?
#5640
Author: Remy Lebeau (TeamB)
Date: Mon, 28 Jun 2004 16:50
23 lines
1825 bytes
"Karsten Leick" <Karsten.Leick@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
Re: How to obtain a free local port automatical ?
#5643
Author: Karsten
Date: Tue, 29 Jun 2004 10:14
55 lines
2500 bytes
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@no.spam.yahoo.com> schrieb im
Newsbeitrag news:40e04d32$1@newsgroups.borland.com...
>
> "Karsten Leick" <Karsten.Leick@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
>
>
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads