EDIT: Sorry, second link is in Visual Basic but it uses WinAPI you'll be able to understand. I'm good with both languages, so I can help the translation if necessary.
P2P File Transfer (Wikipedia)
Advanced Basics: P2P Comm Using Web Services (MSDN)
The first link describes P2P in detail, the second describes how to do something like you want; you can adapt it to your own needs. Please answer the following:
1) What version of C/C++ are you using?
2) Are you using MFC?
3) Are you transfering files or messages stored in files (like IM stuff)?