Use C namespace, and create a better error message on connect failure.
Added port to log output.