Custom packet to send over a socket : <p>Any recommendations on how to encode data to send over a socket?</p>

<p>Example</p>

<pre class="lang-cpp prettyprint-override"><code>struct {
    int id,
    std::string name,
    std::string address
}
</code></pre>

<p>I have this currently:</p>

<pre class="lang-cpp prettyprint-override"><code>std::string s;
client_type client = { INVALID_SOCKET, -1, "" };
send(client.socket, s.c_str(), strlen(s.c_str()), 0);
</code></pre>

<p>I can send a string. What would be the best way to send the above information to the server?</p>
