Heu readn(), c'est pas une fonction qui existe déjà ? Un truc pour lire plusieurs fois à la suite ?
Sinon essaye comme ça :
int read_sock (int sockhandle, unsigned char *buf, int taille)
{
int byte_lu = -1;
unsigned char *ptbuf =buf;
int length = taille;
int i = 0;
do {
byte_lu = read (sockhandle, ptbuf,length);
if (byte_lu > 0)
{
ptbuf = ptbuf+byte_lu;
length = length-byte_lu;
}
i++;
if(i > 10000)
return -1;
} while (length > 0);
return (length);
}Ca devrait marcher comme ça

