I'm running client and server on the same machine with Ubuntu 12.04-amd64 (errors checking have been deleted).
Server send:
Code:
uint32_t fsize;
struct stat fileStat;
fd = open(filename, O_RDONLY);
stat(fd, &fileStat);
fsize = fileStat.st_size
if(send(f_sockd, &fsize, sizeof(fsize), 0) < 0){
perror("error on sending file size\n");
onexit(f_sockd, m_sockd, 0, 2);
}
Client receive:
Code:
uint32_t fsize;
if(recv(f_sockd, &fsize, sizeof(fsize), 0) < 0){
perror("error on receiving file size");
onexit(f_sockd, 0, 0, 1);
}
The problem is that the client receive a biiiig number.
For example the server sent 20 and the client receives 1801745249 O.o
How can i solve this strange behaviour=