Checking if a port is listening

Lucien via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Mar 24 13:37:49 PDT 2016


On Thursday, 24 March 2016 at 12:17:35 UTC, Marc Schütz wrote:
> On Wednesday, 23 March 2016 at 21:37:09 UTC, Lucien wrote:
>> When I remove the Thread.sleep, it doesn't find all adresses. 
>> Why ?
>
> Socket.select() will wait _at most_ 100 msecs. If a socket gets 
> ready before that timeout, it will return immediately. 
> Therefore, you might not get the full TIMES*100 msecs, and some 
> hosts might not have responded in time.

If I change Thread.sleep(100.msecs) to Thread.sleep(6.seconds), 
all hosts respond. What am I doing false ? I don't understand..




More information about the Digitalmars-d-learn mailing list