What you are looking for is local peer-to-peer file sharing. When I was studying, we used eMule, but that is for Windows and old. I don't have a concrete software suggestion, but looking around the gnutella protocol could be promising.
Edit: QuantumCogs suggestion is also good, the use cases are slightly different.