Added a helper method to simplesocket.