I\'m using recv function (C++) in order to get indication about network problem (it return negative value in this case)
Looking here: http://tools.ietf.org/html/rfc1
On most systems, recv() transmit informations by two means : the return code and by setting the global variable errno.
To know what is returned/set in each case, you have to look at the exact API of the recv() function.
Full doc :