connect() with timeout fixed