Ok, so I've created a CSocket derived class named CListenSocket. The overridden OnAccept() is as follows:
void CListenSocket::OnAccept(int nErrorCode)
{
CSocket sockRecv;
sockRecv.Accept(sockRecv);
}
then back at my OnInitDialog() I have the following:
. . . . .
UINT nPort = 666;
CListenSocket sockServ, sockClient;
sockServ.Create(nPort);
sockClient.Create();
sockServ.Listen();
sockClient.Connect("192.168.0.1", nPort);
CSocketFile fileRecv(&sockServ), fileClient(&sockClient);
CArchive arInServ(&fileRecv, CArchive::load);
CArchive arOutClient(&fileClient, CArchive::store);
CString out = "Connected", in;
arOutClient << out;
//arInServ >> in; I will handle the input to the server later because
// this is just to test for a connection
m_sReceive = in;
. . . . .
So should this set up a client to send data (i'll handle the server next)?
boywonder
| Sun, 11 Nov 2007 02:06:00 GMT |