I've been trying different things all weekend trying to figure out what is going on here.
If I log in to my server via a PC and telnet, it comes through just fine. So I know it's my code here is messed up.
Here's my code
while(1)
{
mbstowcs(CHAT," ",strlen(" ")-1 );
Edit_SetText(ctrlCHATLOG, CHAT);
int receivedNumber = recv(lpSocket, szRecvBuffer, DEFAULT_BUFLEN-1, 0);
if(receivedNumber ==-1)
{
break;
}
szRecvBuffer[receivedNumber-1] ='\0';
mbstowcs(CHAT,szRecvBuffer,strlen(szRecvBuffer)-1 );
Edit_SetText(ctrlCHATLOG, CHAT);
}
This is for a textbox on a Pocket PC app.
Lets say my first packet is
"abcdefg"
that will show up fine in my text box.
Then lets say my 2nd packet is
"123"
What shows up is "123defg"
I cant figure out why. I've tried multiple things.