Question

I'm programming a server and a client using non blocking sockets (fd_sets and select function) and once the server closes or shuts down a client socket, the client starts receiving a lot of garbage until it crashes.. I've been warned that when working with select() a socket would become readable when the connection was terminated, but how can I know in

if( FD_ISSET( socket, &read ) ) 
{
} 

if the cause is just regular data or the connection has ended?

Thank you a lot!

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top