C Socket, verifying server -
how 1 check if no connection possible (that is, server down...) c sockets? in other words; client tries establish contact
connect(sock, (struct sockaddr *)&serveraddr, sizeof serveraddr)
, server isn't responding. client should hold of variable verify server status, without using read / write?
connect(3) return -1 on error, , set errno appropriate error.
one case may have handle manually timeout. that, can either use multiple threads (a second thread kills socket if it's not connected after timeout expires), or use non-blocking sockets + poll(2). should rare.
Comments
Post a Comment