Are you sure that select is actually returning that you can read on the socket? Select will also terminate when your program gets a signal, so you have to check that the socket in question is actually in the vector returned by select, even if it's the only thing you pass into select.
Comment on Re: recv blocks even with data to receive