i am haveing trouble transferring int array over socket in c. what is the correct use of htonl()? lets say i have :
int arra[3]={6000,7000,8000};
and socket called new_socket
how do i transfer it correctly to the other end of socket?
client is reading it by the following code:
char buf[BUFLEN] = ""; // buffer for recv() calls
for (i = 0; i < nbytes; i += INTLEN) {
int file_port = ntohl(*(int *)&buf[i]);