I suggest you check all the returns if things go wrong.
This will happen in every app you write, so learning to diagnose these types of issues is vital.
Tell us what this returns (not complied, off the top of my head...)
//WriteFile returns 0 for success
//error occured in WriteFile()
printf("WriteFile failed with %d and GLE returned %d.",iRet,iErr);
//but we should also check if the right amount was writen to file.
//WriteFile did not write the correct amount to the file
printf("WriteFile wrote wrong amount %d of %d [GLE returned %d].",amount,written,iErr);
I also wonder what will happen if amount == sizeof(Buffer) as you will not have a null terminator.
Probably nothing in a complier (and 99.99% of the time in release) but I would be inclined to use (sizeof(Buffer)-1) in recv()