Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By Ahunter
#41801 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.

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);
}
User avatar
By Ahunter
#43243 So I'm revisiting this project, and I've encountered another problem: I need to be able to build packets at runtime, but the method that was specified earlier - client.write(const uint8_t* buffer, size_t size) - only allows the use of "const" qualified variables.
Is there some way around this?
I tried sending the data using the client.write(uint8_t buf) method, but as expected, this sent out individual TCP packets that didn't seem to be able to be reassembled...