When you send the bmp_info_buff
array as char array, the size of bmp_info_buff
is not 3 but is 3 * sizeof(int)
The same for recv
Replace
send(my_socket, (char*)bmp_info_buff, 3, 0);
recv(my_connection, bmp_info_buff, 3, NULL);
by
send(my_socket, (char*)bmp_info_buff, 3*sizeof(int), 0);
recv(my_connection, bmp_info_buff, 3*sizeof(int), NULL);