select function: return error condition when network connection fails