Newsgroups : Borland : borland.public.delphi.internet.winsock : 2007 Jan : Re: idHTTPServer pick random port

www.cryer.info
Managed Newsgroup Archive

Re: idHTTPServer pick random port

Subject:Re: idHTTPServer pick random port
Posted by:"Remy Lebeau (TeamB)" (no.spam@no.spam.com)
Date:Tue, 2 Jan 2007 17:27:49

"GS" <info@no-spam-.com> wrote in message
news:459ac877$1@newsgroups.borland.com...

> With the TServerSocket component if I assign port # 0 to the
> component, it will pick a random available port to listen on.
> Does idHttpServer work the same ?

Yes.  What you describe is a characteristic of the underlying socket
API itself.

> If so then after I set the idHTTPServer active property to
> true, how can I find out what port it is listening on ?

Read the Port property of each item in the Bindings collection that
you are interested in.  TServerSocket can only listen on one IP/Port
pair at a time, whereas TIdHTTPServer (or any TIdTCPServer-derived
class) can listening on multiple IP/Port pairs at a time.  Each item
in the Bindings collections represents one IP/Port pair that is
listening.


Gambit

Replies:

In response to:

www.cryer.info
Managed Newsgroup Archive