samedi 9 mai 2015

Detect closed connection on non blocking socket

I'm really sorry if my question is a duplicate, but I didn't find useful infos in the site.

I'm using non blocking sockets and a select(). How can I detect if a client closed the connection on non-blocking socket? I saw that a read() returns -1 with errno = EWOULDBLOCK when no datas are available to be read and also when a connection is closed.

How can I discriminate above cases?

Thanks!

Aucun commentaire:

Enregistrer un commentaire