I'm in quite a mess with my little chat server application. Before it ran just fine, but now when I run it, I get an error when I call the OnReceive() function.
here is the code:
// ~~paste line~~//
void CNetspan2Dlg::OnReceive()
{
char *pBuf = new char[1025];
int iBufSize = 1024;
int iRcvd;
CString strRecvd;
//m_iClients is an integer that keeps track of the number
//of clients, for the purposes of all my tests, there has
//only been 1 client.
iRcvd = m_vConnectSockets[m_iClients].Receive(pBuf, iBufSize);
if (iRcvd == SOCKET_ERROR)
{
MessageBox("Socket ERROR (Receive[m_iClients])","Sox error"
}
else
{
pBuf[iRcvd] = NULL;
strRecvd = pBuf;
m_ctrlBuffer.AddString(strRecvd);
UpdateData(FALSE);
}
}
here is the code:
// ~~paste line~~//
void CNetspan2Dlg::OnReceive()
{
char *pBuf = new char[1025];
int iBufSize = 1024;
int iRcvd;
CString strRecvd;
//m_iClients is an integer that keeps track of the number
//of clients, for the purposes of all my tests, there has
//only been 1 client.
iRcvd = m_vConnectSockets[m_iClients].Receive(pBuf, iBufSize);
if (iRcvd == SOCKET_ERROR)
{
MessageBox("Socket ERROR (Receive[m_iClients])","Sox error"
}
else
{
pBuf[iRcvd] = NULL;
strRecvd = pBuf;
m_ctrlBuffer.AddString(strRecvd);
UpdateData(FALSE);
}
}