Read the Chapter 2. Peer-to-Peer Communication by Means of the Selections of the Inter-Client Communication Conventions Manual. See also Chapter 3. Peer-to-Peer Communication by Means of Cut Buffers. I would also recommend to read the section about Atoms.
Everything you want to know is basically explained in the conventions.