I want to write a program to monitor a network with 80 devices that they have IPs. I am Delphi programmer. It doesn't matter to use Indy or ICS or any other libraries. I want check these devices by pinging (TIdIcmpClient or TPing). I just thinking about writing threads to check each device separately. But in this post Delphi (XE2) Indy (10) Multithread Ping an expert which himself is in Indy project (Remy Lebeau) said in his answer that windows itself is suffering from multiple instances interfering with each others' replies. He suggested to use one socket thread and the other threads use this thread for pinging. but I think in this case it is same as writing this checking in serial and maybe it is better to write it in serial, because it doesn't need to check critical section. My question is, can't we use any way to ping multiple devices with dependent threads? does Linux have same problem like windows that Remy Lebeau mentioned?
I just wondering why the responses from multiple instances may interfere each other. does ICMP encapsulated in IP or not (ICMP_Packet)? if it does why can't we understand from what source this reply is coming? if we can see the source why we may mistaken the response?(if you see the link about the ICMP packet in the follow you see an example that the ping command resulted with responses that the IP is obvious on them.) there is another thing. who process this ICMP? I mean when someone ping another device, that device how reply to the ping request? there are listeners or what? and when the device ping the other who is waiting for response? ping is a request or not? if not what is it? and the last thing. How can I forge my own ping request by making the packet and trace it?
so many question. I am confused.
Answer: Yes. but if you want use 3rd-party components don't use Indy. It has problem in it's core. use ICS. You can find OverbyteIcsPingTst.dproj in the demos of this open-source pack of components. btw the answer that is given in Delphi (XE2) Indy (10) Multithread Ping and accepted by the person who asked this question is not work well! because it uses the Indy and the writer of the code himself in DoPing function of his code commented that:
//We will send here, but if we have recently sent some Pings, we may receive
//a response to a previous Ping and not get a response to our particular Ping
so this unit because using of Indy can not be use if it is important for you to have a true response!