Datasheet

API in C using winsock
62
else
{
cEncodedLength[0] = cLength[2] | 0x80;
cEncodedLength[1] = cLength[3];
}
send (fdSock, cEncodedLength, 2, 0);
}
// write 3 bytes
else if (iLen < 0x200000)
{
DEBUG ? printf("iLen < 0x200000.\n") : 0;
if (iLittleEndian)
{
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];
}
send (fdSock, cEncodedLength, 3, 0);
}
// 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];