I would be happy to help you (if I can). I will tell you what I do in establishing CSocket connections. I don't know if it is the best way but it works for me and I try to keep things simple.
First, I create a class derived from CSocket, named CMySocket perhaps.
Next, I create 5 virtual void functions in the derived class named:
OnAccept(int nErrorCode)
OnConnect(int nErrorCode)
OnSend(int nErrorCode)
OnReceive(int nErrorCode)
and
OnClose(int nErrorCode)
These functions are overridden. They will be automatically called when the socket can accept a connection, is connected, can send info, can receive info, and has been disconnected remotely (respectively).
In these functions, I provide code that merely calls a function in the main class I working with (for me it is usually a dialog class and I have each function call MyDialog.Send() or MyDialog.Receive() etc)
One program must act as a server and one as a client.
The server program must have 2 instances of your CMySocket.
The client will have 1.
One of the server sockets must be created bound to a specific port of your choosing.
ServSocket.Create(4000);
Then it should listen for connection attempts:
ServSocket.Listen();
The client socket can be created without a port specified:
ClientSocket.Create();
It should attempt to connect to the ServSocket using the IP address (as a CString) and port number (int):
ClientSocket.Connect(sAddress, iPort);
The server socket's OnAccept function will then be called. The server socket must accept the connection and assign it to the second server socket:
ServSocket.Accept(ServSocket2);
The clients socket's OnConnect function will then be called if the connection is made.

From there you will do your communication between ServSocket2 and ClientSocket. When one sends the other's OnReceive will be called. To actually send information, I use instances of CArchive's bound to CSocketFile's which are bound to the CMySocket instances. To figure these out it would probably be better to consult MSDN than me.

Hope I've been helpful. Let me know if so. If not, sorry.