Setup debug switch to control cpp flags and library name
Changed exception message to include address and port
Exposed socket close state and setup checks so close isn't called multiple times