Here is code from server
while (fgets(buffer, sizeof(buffer), log_file) != NULL) {
printf("%dn", i);
send(sd, buffer, strlen(buffer), 0);
}
Here is code from client, where i catch messages from server
char message[MAX_LOG_LINE_LENGTH];
int valread;
for (int i = 0; i < MAX_LOG_LINES; ++i) {
valread = recv(sock, message, MAX_LOG_LINE_LENGTH, 0);
if (valread <= 0) {
break;
}
printf("%d ::: %sn", i, message);
fflush(stdout);
}```
But idk why when i catch messages, sometimes all lines in one messages, sometimes, all lines in MAX_LOG_LINES lines
I want to send MAX_LOG_LINES messages and get them in MAX_LOG_LINES messages