Fixed brace bug, refactored send to handle EINTR.