Initiating a TLS handshake using an ESP8266 with Arduino IDE
<p>I'm trying to initiate a TLS handshake using an ESP8266 over TCP, but the server I'm sending the packet to keeps returning a TLS decode error (code 50).</p>

<p>The packet itself is composed and sent as follows:</p>

<pre><code>const uint8_t packet[] = "\x16\x03\x03\x00\x2f\x01\x00\x00\x2b\x03\x03\x2b\x7e\x15\x16\x28\xae\xd2\xa6\xab\xf7\x15\x88\x09\xcf\x4f\x3c\x2b\x7e\x15\x16\x28\xae\xd2\xa6\xab\xf7\x15\x88\x09\xcf\x4f\x3c\x00\x00\x02\x00\xa0\x01\x00\x00";
client.write(packet, sizeof(packet))
</code></pre>

<p>I've heard that this error can result from an error in the packet, like having an incorrect length, but I think it's composed right. (for reference, I used the <a href="https://en.wikipedia.org/wiki/Transport_Layer_Security#TLS_record" rel="nofollow" title="Wikipedia page">Wikipedia Page</a> and some real TLS packets). 
I also came across <a href="http://forum.streamsec.net/Forum/SSLTLS/TopicID531.htm" rel="nofollow">this thread</a> which mentions explicit and implicit TLS/SSL, but I'm not quite sure if/how it relates to my problem.</p>

<p>What am I doing wrong? I'm considering trying DTLS if this isn't feasible.</p>