I have troubles with sending an array of ints over a socket. the code looks like this
Program 1: (running on windows)
int bmp_info_buff[3];
/* connecting and others */
/* Send informations about bitmap */
send(my_socket, (char*)bmp_info_buff, 3, 0);
Program 2: (running on neutrino)
/*buff to store bitmap information size, with, length */
int bmp_info_buff[3];
/* stuff */
/* Read informations about bitmap */
recv(my_connection, bmp_info_buff, 3, NULL);
printf("Size of bitmap: %d\nwidth: %d\nheight: %d\n", bmp_info_buff[0], bmp_info_buff[1], bmp_info_buff[2]);
It should print
Size of bitmap: 64
width: 8
height: 8
Size of bitmap: 64
width: 6
height: 4096
What do I do wrong?
htonl
,ntohl
, etc. – Brannon