ws) provide the POSIX compatible <i>connect</i> function. For example:</p>

<pre><code>struct sockaddr_in serveraddr;
struct hostent *server;

server = gethostbyname(&quot;www.openssl.org&quot;);
if (server == NULL) {
    close(sock);
    return NULL;
}

memset(&amp;serveraddr, 0, sizeof(serveraddr));
serveraddr.sin_family = server-&gt;h_addrtype;
serveraddr.sin_port = htons(443);
memcpy(&amp;serveraddr.sin_addr.s_addr, server-&gt;h_addr, server-&gt;h_length);

if (connect(sock, (struct sockaddr *)&amp;serv