Datasheet
API in C using winsock
63
cEncodedLength[2] = cLength[2];
cEncodedLength[3] = cLength[3];
}
send (fdSock, cEncodedLength, 4, 0);
}
else // this should never happen
{
printf("length of word is %d\n", iLen);
printf("word is too long.\n");
exit(1);
}
}
/********************************************************************
* Write a word to the socket
********************************************************************/
void writeWord(int fdSock, char *szWord)
{
DEBUG ? printf("Word to write is %s\n", szWord) : 0;
writeLen(fdSock, strlen(szWord));
send(fdSock, szWord, strlen(szWord), 0);
}
/********************************************************************
* Write a sentence (multiple words) to the socket
********************************************************************/
void writeSentence(int fdSock, struct Sentence *stWriteSentence)
{
int iIndex;
if (stWriteSentence->iLength == 0)
{
return;
}
DEBUG ? printf("Writing sentence\n"): 0;
DEBUG ? printSentence(stWriteSentence) : 0;
for (iIndex=0; iIndex<stWriteSentence->iLength; iIndex++)
{
writeWord(fdSock, stWriteSentence->szSentence[iIndex]);
}










