Hi everybody!!!!! I need to pass an int array through send() function and I do it in this way:

server side:
int array[10];
char* buffer;
buffer = (char*)malloc(20);
buffer = (char*) array;
send(socket, buffer, sizeof(buffer), 0);

client side:
int *array;
char *buf;
recv(socket, buf, 20, 0);
array = (int *)buf;

According to you, what's wrong? Data I receive have different values from those I send. Where is the problem?
Thanks.