count established connections
check if socket descriptor is valid
check if socket descriptor is still alive