Ok thank you Salem but its still not too clear to me how these functions work.
For example when exactly a recv() function stops recieving?
I imagine its something like the send() function knows how many bytes it has to send (because we have to precise it) and it gets transmitted to the recv function and when it recieved the number of bytes it stops recieving.
Because if i follow your reasoning that it would recieve every other send() function, it should never stop recieving.
So there must be something that tells him to stop.
Otherwise in every code there would be extra delimiter characters added to it and i never see it in any code.
Btw i managed to fix the code by adding Sleep() on the sender side but i as i read everywhere its not the real solution.
I just cant believe they made it so complicated to send and recieve data.
And every code i see is like mine or even worse because theyre not even sending the size of the file before.
So how come its working for everybody and you telling me to send delimiter characters in addition?