TCP / IP is an OS independent protocol, so the fact that you are using XP on a server should not affect anything other than the potential use of the window API for socket operations.
Klaus Broch is right in saying that 499 bytes looks a bit small for the image. Instead, I suggest that you first find the total image size (in bytes) on the server, and then send this value at the beginning of the TCP stream, and then the image data. On the receiving side, your code must first read this size value, allocate some memory of that size, and then read that there are many bytes in it. You have not posted your server code, so I can not help it, but the client might look something like this:
unsigned int size = 0; //assumes the size is sent as an int Byte* recvBuffer; [iStream read:&size maxLength:sizeof(unsigned int)]; recvBuffer = new Byte[size]; memset(recvBuffer, 0, size); [iStream read:recvBuffer maxLength:size]; NSData *webdata = [NSData dataWithBytes:recvBuffer length:size]; imageview.image = [UIImage imageWithData:webdata]; delete [] recvBuffer;
Change My internal C ++ made me use the new and delete. Although you can use this in Obj-C using the suffix of the .mm file, this question is tagged with Objective-C. You should use JeremyP's answer as it also includes error checking and a more reliable way to read the full image.
source share