Thank you for your answer, but the problem is not about the dynamic allocation or the malloc cast, elsewhere I used char buffer [buffer_size] and the problem remains the same. My main subject is when I send a mesage after the transfert of file, the server receives a empty message