I want to implement at the client side non-blocking socket with select function. But it doesn\'t work as expected. In the code below it never runs into else , rv is always 1
You set the timeout (last parameter of select) to NULL, which means it will only return once data are available on the socket (or interrupt). You need to set a timeout it should wait. The timeout might be 0 if you don't want to wait, but 0 means to use a struct timeval*
with tv_sec=0
and tv_usec=0
and not use a struct timeval*
of NULL like you did.