Datasheet
API in C
221
{
cEncodedLength[0] = cLength[2] | 0xc0;
cEncodedLength[1] = cLength[1];
cEncodedLength[2] = cLength[0];
}
else
{
cEncodedLength[0] = cLength[1] | 0xc0;
cEncodedLength[1] = cLength[2];
cEncodedLength[2] = cLength[3];
}
write (fdSock, cEncodedLength, 3);
}
// write 4 bytes
// this code SHOULD work, but is untested...
else if (iLen < 0x10000000)
{
DEBUG ? printf("iLen < 0x10000000.\n") : 0;
if (iLittleEndian)
{
cEncodedLength[0] = cLength[3] | 0xe0;
cEncodedLength[1] = cLength[2];
cEncodedLength[2] = cLength[1];
cEncodedLength[3] = cLength[0];
}
else
{
cEncodedLength[0] = cLength[0] | 0xe0;
cEncodedLength[1] = cLength[1];
cEncodedLength[2] = cLength[2];
cEncodedLength[3] = cLength[3];
}
write (fdSock, cEncodedLength, 4);
}
else // this should never happen
{
printf("length of word is %d\n", iLen);
printf("word is too long.\n");
exit(1);
}
}










