One embodiment of the present invention provides a system that facilitates
automatically using a predefined networking group, such as a peer-to-peer
group as a context for an application. The system starts by executing the
application on behalf of a peer. During execution of the application, the
system determines if the peer is a member of a networking group, and if
so, the system uses the networking group as a context for the
application.