made getting socket length more fancy

This commit is contained in:
Václav Šmejkal 2023-02-22 11:03:15 +01:00
parent ba6aacb1b4
commit 58d5c7ede8
Signed by: ENGO150
GPG Key ID: F6D6DF86242C5A59

View File

@ -174,7 +174,11 @@ char *why2_read_socket(int socket)
char *content_buffer = why2_calloc(3, sizeof(char));
//GET LENGTH
if (recv(socket, content_buffer, 2, 0) != 2) return NULL;
if (recv(socket, content_buffer, 2, 0) != 2)
{
fprintf(stderr, "Getting message length failed!\n");
return NULL;
}
content_size = (unsigned short) (((unsigned) content_buffer[1] << 8) | content_buffer[0]);