🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.socket
Article #5639

How to obtain a free local port automatical ?

#5639
From: 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.
Technical Details
Message-ID: <40e02f4d$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,4d3f7a57e188cdef,start
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
Reply-To: "Karsten Leick" <Karsten.Leick@cetecom.de>
From: "Karsten Leick" <Karsten.Leick@cetecom.de>
Newsgroups: borland.public.cppbuilder.internet.socket
Subject: How to obtain a free local port automatical ?
Date: Mon, 28 Jun 2004 16:46:02 +0200
Lines: 30
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 212.185.175.249
Message-ID: <40e02f4d$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1088433997 212.185.175.249 (28 Jun 2004 07:46:37 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail