socket: Raise an error if open function failed.