updated for SSl Sockets