A technique to automatically determine Ad-hoc communication patterns at runtime