add socket error-handling. Closes #6

otherwise node just explodes, not a good default