This is a software problem, not a hardware problem. If it were a hardware problem, it would be with your wireless adapter/ethernet (depending on which you use), but most likely your failures would be consistent and reproducible.
Does the same thing happen under a different OS X account on that same machine?