So far, this seems to work very well under Win32. I will test it under Linux when I get back to my office. Thanks a lot.
One question: Do you see any problem with removing the sleep 1; line from the loop? This code will be part of a loop itself to test the response of about 150 machines. I can normally get responses from up to ten machines per second. With the sleep line, that will drop it to maybe one machine every couple of seconds, which is a big performance hit. So far it appears to work reliably without the sleep line.