Newsgroups : Borland : borland.public.delphi.internet.winsock : 2007 Feb : Re: TIdSimpleServer or TIdTCPServer
| Subject: | Re: TIdSimpleServer or TIdTCPServer |
| Posted by: | "Remy Lebeau (TeamB)" (no.spam@no.spam.com) |
| Date: | Fri, 23 Feb 2007 12:37:22 |
"Philip von Melle" <philip.vonmelle@globetrotter.de> wrote in message
news:Xns98E091A1DDE53philipvonmelleglobe@207.105.83.66...
> What would I need to call BeginListen() for?
BeginListen() binds the socket locally and starts listening, but does
not actually accept any client connections. Listen() is what accepts
the connection. So, in order for B to connect to A, B has to know the
Port that A is actually listening on. So you would call BeginListen()
to bind the socket, then grab the Port it actually bound to and send
that to B, and then call Listen() to accept B's connection. This is
particular important if you use the BoundPortMin and BoundPortMax
properties to support Port ranges, as the Port will not be predictable
ahead of time.
> IdSimpleServer.BoundPort := 20007;
At no point are you sending that Port to B. You should do so. That
way, the Port can be used more dynamically, which is very important
when firewalls and routers are involved.
Gambit