my problem is that when trying to send a .txt file from the server to the client, when the client receives the file only the first line of code in the txt is shown when in fact the entire file has to be shown, does anyone know how can i fix this problem?
Server
FILE * Log = fopen("Log.txt", "r");
while(!feof(Log)){
char ms[T_MAX];
fgets(ms, T_MAX, Log);
if(send(client_socket, ms, T_MAX, 0) < 0){
printf("\n[SERVER] ERROR -> %d\n",WSAGetLastError());
closesocket(servidor_socket);
closesocket(client_socket);
WSACleanup();
return(1);
}
}
fclose(Log);
this is what the server reads and would have to send to the client.
**
2022-10-24-17:18 :=============================
2022-10-24-17:19 :=======Example=======
2022-10-24-17:20 :=============================
**
Client
if(recv(socket_aplication, ms, T_MAX, 0) <= 0){
printf(" ERROR -> %d\n",WSAGetLastError());
closesocket(socket_aplication);
WSACleanup();
return (1);
}
//here we show in the client console the result of what the server gave us
printf(ms);
this is what the client console shows
**
2022-10-24-17:18 :=============================
**