These are chat archives for IndySockets/Indy

Oct 2017
Elazar DornellesCeza
Oct 06 2017 03:11

@rlebeau I made something working with TCriticalSection to commands run in sequence, at this moment it solves the problem. But if exist a lot of ips (or names) to test it could be a problem...

I was looking for some answers in the IdIcmp sources and I guess an implementation can be done using the idea of "sequence" propertie inside, where each ping command will receive an identified echo with this sequence id.

Elazar DornellesCeza
Oct 06 2017 03:18
There is a line where the sequence Id is retrieved, so, if we use the sequence parameter (Ping(host, sequenceid)), it works, except if used with threads, because one thread can read and ignore answers from another one - raw sockect implementation... it is exact like you said before.
"LActualSeqID := LIcmp.icmp_hdr.icmp_hun.echo_seq"
Oct 06 2017 06:56
@rlebeau yup, your answer with the detail explaination was just my first link ;-)
@razalE_twitter My last link still contains a link to googlecode, which is turned offline, but all source was transfered to github. So here you find a finished solution for handling multithreaded pings. As @rlebeau mentioned it uses a TMonitor and as you mentioned it also uses unique SequenceIDs for identification.
Remy Lebeau
Oct 06 2017 18:00
@razalE_twitter I already mentioned in my StackOverflow answer a way to address this situation (not using TIdIcmpClient, though). Have each thread send its own ping request, and then use a dedicated thread to receive all of the ping replies and delegate them to the appropriate threads for processing.
Oct 06 2017 18:01
Hi there, yep, i miss the answer for some time, but now it is working.
Thansk for you all! :-)