In my app whenever a button is pressed, a function starts checking the state of some Checkboxes and Edit Controls and start X (up to 10) threads to ping the host adresses that were in this Edit Controls. Up to now things are going great, only problem is that I donīt know how to deal with a timeout, my program is waiting forever for the replies.
I though of creating a Windows Timer, once the Time specified in the TimeOut Field is reached it reads the ping buffer: If thereīs nothing there the host was not found. Else it was a TimeOut. Then I would kill the thread.
But I am almost sure that is not the most correct way to do it, there might be some smarted way that iīm not aware off. I think itīs not very correct either to just go killing threads like that, without letting it free itīs resources when it exits correctly right?
Does anyone has any idea that could help me? Any help will be great, Thanks!
PS: Iīm using MS ICMP API, loading 'icmp.dll' and calling IcmpSendEcho.