Added isOpen method; initialized socketfd to -1 in constructor; added some comments.