ucting the socket; and connecting the socket.</p>

<p>How to construct a socket is platform specific - but most platforms (including Windows) provide a POSIX compatible interface via the <i>socket</i> function, e.g. to create an IPv4 TCP socket:</p>

<pre><code>int sock;

sock = socket(AF_INET, SOCK_STREAM, 0);
if (sock == -1)
    return NULL;</code></pre>

<p>Once the socket is constructed it must be connected to the remote server. Again the details are platform specific but most platforms (including Windo