i've been working on wrapper class for winsock functions, and i've been tracing down a lag-style issue (the program freeze-lags) and it comes from my send function. if someone could help me out and point out any issues that would really help me out.
Code:
//typical call would be ::perSend(crchat, 1024);
//usually though, the crchat is not 1024 in length. i've tried adding an if(...)break to stop
//when the delimiter was hit, but it didn't do anything.
INT PEER::perSend(CHAR *databuff, INT len)
{
char *zbuff = databuff;
while (len > 0)
{
iSentBytes = send(sckPeer, zbuff, 1, 0);
if (iSentBytes == SOCKET_ERROR)
{
if ((iError = WSAGetLastError()) != WSAEWOULDBLOCK)
return -1;
}
iTSentBytes += iSentBytes;
zbuff++;
len--;
}
return iTSentBytes;
}