Have you ever considered actually checking the return values of send() and recv()?