Guys, how do I check if a PC connected to a network is online?

I created a program that will distribute a file to all IP addresses given.

My problem is, when the user gives an IP that is offline (turned off or not connected to the network), the program hangs for a few seconds while executing the FileCopy procedure then returns an error that the path can't be found.

I wanted to prevent the hang up and I think I can do that by checking first if the IP is online before going to the FileCopy procedure.

Thanks a lot guys!