created a class to wrap socket calls