Well, if there is a timer before the computer shuts down, e.g 20 Seconds, you can goto the command prompt and type: "shutdown -a" (minus quotes) to cancel it. (XP only I think)

This happens to me too, I'm not sure of any preventetive measures that can be taken though... Maybe a service that can be disabled? Although that may break other network functionality.