* Md Lazreg wrote on Thu, Jan 08, 2009 at 15:11 +0100: > The problem in my case was a server one. I use a non-blocking socket for the > server to receive information from the clients, so the server performs a > select with a timeout of 1 second to read information. It turns out that > when they are network issues, 1 second is not enough and the select times > out with a 0 return value, so the server was assuming that the client is > gone and closes the connection.... > > Now, when the select times out I check the errno and if it is EAGAIN, I try > select again... This solved the problem and all clients now are handled > correctly... > > What confused me is the man select documentation which states that select > sets errno only if the return value is -1... it seems that even if it > returns 0 errno might be set... > > I have seen this problem on Linux and Hp platforms...
errno always has a value. It might be defined (if a function returned -1) or a `random' value (such as 11, EAGAIN or whatever, usually highly predictable :)). My man page seems to be very clear about select timing out with a 0 return value: RETURN VALUE On success, select and pselect return the number of descriptors contained in the descriptor sets, which may be zero if the timeout expires before anything interesting happens. I think usually the `client is gone', `connection closed' or `end of file' situation is when select(2) does return `read for read' for this file descriptor and read(2) returns zero [from man 2 read: `On success, the number of bytes read is returned (zero indicates end of file)']. oki, Steffen -- [end of message. please ignore the rest of this mail] ------------------------------------------------------------------->8======= About Ingenico: Ingenico is the world's leading provider of payment solutions, with over 15 million terminals deployed across the globe. Delivering the very latest secure electronic payment technologies, transaction management and the widest range of value added services, Ingenico is shaping the future direction of the payment solutions market. Leveraging on its global presence and local expertise, Ingenico is reinforcing its leadership by taking banks and businesses beyond payment through offering comprehensive solutions, a true source of differentiation and new revenues streams. This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. P Please consider the environment before printing this e-mail ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager majord...@openssl.org