I don't know the application scenario, but if you happen to be the communication master (this means that you get an answer only if you ask a question), then it can be done easilly with software. Throw some bytes on the line. If you get answer, PC is still there. If not, then you try a couple more times and if no answer comes, you scan next port. If you are the slave on the other hand and wait for periodic data, then you can have a communication timeout error (that is PC stayed quiet for a long time). In most cases (not all) you are able to detect this from the software.