Detect connect failure on Linux