Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sockets -- OnReceive() Error...

Status
Not open for further replies.

RobTheMod

Programmer
Apr 20, 2001
2
US
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);
}
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top