char sizebuffer;
char size[20];
int r = 0;
ZeroMemory(size, sizeof(size));
ZeroMemory(&sizebuffer, sizeof(sizebuffer));
do
{
if( (r = recv (client,&sizebuffer,sizeof(sizebuffer),0)) == SOCKET_ERROR) // get size
{
int e = WSAGetLastError();
return 0;
}
else
{
strcat(size, &sizebuffer);
i++;
}
} while(sizebuffer != '!');
in my FD_READ message, it should read one charater from the buffer until it hits a '!'. When I look at it in debug mode though, r, which is supposed to hold the number of bytes read, is 1 as it is supposed to be. But, sizebuffer has a bunch of extra characters on it, even though it is only 1 character, so when strcat is called, size get the character and about 4 characters of extra garbage. If I have it use size in recv and change the 1 to sizeof(size), then it readds all the characters. Is that problem that winsock can't read less than 4 or 5 bytes at a time? Help! Thanks in advance.
My Geekcode: "GCS d s: a14 C++$ P+(++) L+ E-- W+++$ K- w++(+++) O---- M-- Y-- PGP- t X
R- tv+ b++ DI+(+++) D- G e* h!"
Decode my geekcode!
Geekcode.com
Visit our web site: Asylum Entertainment Edited by - ziplux on 12/4/00 7:55:30 PM