Fixed bug on sock_read. It returns 0 when an error reading occurs, and this situation was not being controlled.