Audiovox P965 Arkusz Danych Strona 70

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 280
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 69
API in C using winsock
67
// read iBytesToRead from the socket
iBytesRead = recv(fdSock, szTmpWord, iBytesToRead, 0);
// terminate szTmpWord
szTmpWord[iBytesRead] = 0;
// concatenate szTmpWord to szRetWord
strcat(szRetWord, szTmpWord);
// subtract the number of bytes we just read from iLen
iLen -= iBytesRead;
}
// deallocate szTmpWord
free(szTmpWord);
DEBUG ? printf("word = %s\n", szRetWord) : 0;
return szRetWord;
}
else
{
return NULL;
}
}
/********************************************************************
* Read a sentence from the socket
* A Sentence struct is returned
********************************************************************/
struct Sentence readSentence(int fdSock)
{
struct Sentence stReturnSentence;
char *szWord;
int i=0;
int iReturnLength=0;
DEBUG ? printf("readSentence\n") : 0;
initializeSentence(&stReturnSentence);
while (szWord = readWord(fdSock))
{
addWordToSentence(&stReturnSentence, szWord);
Przeglądanie stron 69
1 2 ... 65 66 67 68 69 70 71 72 73 74 75 ... 279 280

Komentarze do niniejszej Instrukcji

Brak uwag