Sending custom packets using ESP8266WiFi library
Posted: Wed Feb 24, 2016 9:38 am
I've got a little project which involves sending TLS packets. For this, I need to be able to make up a custom packet.
At the moment I'm using ESP8266WiFi to open a TCP connection on port 443 (which works), and then using client.print(packet) to send the data. It all compiles, but when I capture the packets on the access point, all I get is a load of TCP packets that don't contain any of the data I tried to send.
Am I using the print() method wrong, or is this the wrong way to go about doing this?
I've posted the important parts of the code below. everything after the [...] is in the loop() function.
At the moment I'm using ESP8266WiFi to open a TCP connection on port 443 (which works), and then using client.print(packet) to send the data. It all compiles, but when I capture the packets on the access point, all I get is a load of TCP packets that don't contain any of the data I tried to send.
Am I using the print() method wrong, or is this the wrong way to go about doing this?
I've posted the important parts of the code below. everything after the [...] is in the loop() function.
Code: Select all
#include <ESP8266WiFi.h>
[...]
WiFiClient client;
const int httpPort = 443;
if (!client.connect(host, httpPort)) {
Serial.println("connection failed");
return;
}
else {
char packet[] = "\x16\x03\x01\x00\x2c\x01\x00\x00\x28\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\x02\x00\xa0\x00\x00";
client.print(packet);
}